이해하는 데 참고한 글
React Query와 함께 Concurrent UI Pattern을 도입하는 방법 | 카카오페이 기술 블로그
function PostContainer() {
const params = useSearchParams();
const id = useMemo(() => params.get(id), params);
// Content 에서 이용하고 있는 `useSuspenseQuery`가
// 완료되지 않았으면 fallback prop의 컴포넌트 렌더
<Suspense fallback={<Spinner/>}>
<Content id={id}/>
</Suspense>
}
function Content({id}) {
const {data} = useSuspenseQuery({
queryKey: ['post', id]
});
return <h1>{data.title}</h1>
}