SuspenseQueries
Just as <SuspenseQuery/>
makes useSuspenseQuery easier to use in jsx, <SuspenseQueries/>
serves to make useSuspenseQueries easier to use in 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>
)