SuspenseQueries
<SuspenseQuery/>
๊ฐ useSuspenseQuery๋ฅผ jsx์์ ์ฝ๊ฒ ์ฌ์ฉํ๊ฒ ํ๋ ์ญํ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก <SuspenseQueries/>
๋ useSuspenseQueries๋ฅผ jsx์์ ์ฌ์ฉํ๊ธฐ ์ฝ๊ฒ ํ๊ธฐ ์ํ ์ญํ ์ ํฉ๋๋ค.
import { SuspenseQueries } from '@suspensive/react-query'
import { Suspense, ErrorBoundary } from '@suspensive/react'
import { PostListItem, UserProfile } from '~/components'
const PostsPage = ({ userId }) => (
<ErrorBoundary fallback={({ error }) => <>{error.message}</>}>
<Suspense fallback="loading...">
<SuspenseQueries
queries={[userQueryOptions(userId), postsQueryOptions(userId)]}
>
{([{ data: user }, { data: posts }]) => (
<>
<UserProfile {...user} />
{posts.map((post) => (
<PostListItem key={post.id} {...post} />
))}
</>
)}
</SuspenseQueries>
</Suspense>
</ErrorBoundary>
)