diff --git a/docs/suspensive.org/src/pages/en/index.mdx b/docs/suspensive.org/src/pages/en/index.mdx index 308c280a0..c29bf63d2 100644 --- a/docs/suspensive.org/src/pages/en/index.mdx +++ b/docs/suspensive.org/src/pages/en/index.mdx @@ -28,36 +28,36 @@ In this case, you can check `isLoading` and `isError` to handle loading and erro ```jsx ! Page.jsx const Page = () => { - const userQuery = useQuery(userQueryOptions()) - const postsQuery = useQuery({ - ...postsQueryOptions(); - select: (posts) => posts.filter(({ isPublic }) => isPublic), - }) - const promotionsQuery = useQuery(promotionsQueryOptions()) - - if ( - userQuery.isLoading || - postsQuery.isLoading || - promotionsQuery.isLoading - ) { - return 'loading...' - } - - if (userQuery.isError || postsQuery.isError || promotionsQuery.isError) { - return 'error' - } - - return ( - - - {postsQuery.data.map((post) => ( - -))} -{promotionsQuery.data.map((promotion) => ( - -))} - -) + const userQuery = useQuery(userQueryOptions()) + const postsQuery = useQuery({ + ...postsQueryOptions(), + select: (posts) => posts.filter(({ isPublic }) => isPublic), + }) + const promotionsQuery = useQuery(promotionsQueryOptions()) + + if ( + userQuery.isLoading || + postsQuery.isLoading || + promotionsQuery.isLoading + ) { + return 'loading...' + } + + if (userQuery.isError || postsQuery.isError || promotionsQuery.isError) { + return 'error' + } + + return ( + + + {postsQuery.data.map((post) => ( + + ))} + {promotionsQuery.data.map((promotion) => ( + + ))} + + ) } ``` @@ -113,33 +113,33 @@ However, since `useSuspenseQuery` is a hook, the component must be separated to ```jsx ! Page.jsx const Page = () => ( - - - - - - - + + + + + + + ) const UserInfo = ({ userId }) => { - const { data: user } = useSuspenseQuery(userQueryOptions()) - return + const { data: user } = useSuspenseQuery(userQueryOptions()) + return } const PostList = ({ userId }) => { - const { data: posts } = useSuspenseQuery({ - ...postsQueryOptions(); - select: (posts) => posts.filter(({ isPublic }) => isPublic), - }) - return posts.map((post) => ) + const { data: posts } = useSuspenseQuery({ + ...postsQueryOptions(), + select: (posts) => posts.filter(({ isPublic }) => isPublic), + }) + return posts.map((post) => ) } const PromotionList = ({ userId }) => { -const { data: promotions } = useSuspenseQuery(promotionsQueryOptions()) -return promotions.map((promotion) => ( - -)) + const { data: promotions } = useSuspenseQuery(promotionsQueryOptions()) + return promotions.map((promotion) => ( + + )) } ```