-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(react-query): add docs for usePrefetchInfiniteQuery (#1299)
# Overview <!-- A clear and concise description of what this pr is about. --> I added docs for usePrefetchInfiniteQuery and I added @gwansikk @kangju2000 as co-author ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests. Co-authored-by: Gwansik Kim <[email protected]> Co-authored-by: Juhyeok Kang <[email protected]>
- Loading branch information
1 parent
1848a2e
commit b23447f
Showing
6 changed files
with
120 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
docs/suspensive.org/src/pages/docs/react-query/usePrefetchInfiniteQuery.en.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Callout, Sandpack } from '@/components' | ||
|
||
# usePrefetchInfiniteQuery | ||
|
||
The usePrefetchInfiniteQuery does not return anything, it should be used just to fire a prefetch during render, before a suspense boundary that wraps a component that uses useSuspenseInfiniteQuery. | ||
|
||
```jsx /usePrefetchInfiniteQuery/ | ||
import { usePrefetchInfiniteQuery, useSuspenseInfiniteQuery } from '@suspensive/react-query' | ||
|
||
const PostsPage = ({ postId }) => { | ||
usePrefetchInfiniteQuery({ | ||
queryKey: ['posts'], | ||
queryFn: () => getPosts(), | ||
}) // Prefetch query before suspense boundary | ||
|
||
return ( | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<Posts postId={postId} /> | ||
</Suspense> | ||
) | ||
} | ||
|
||
export const Posts = () => { | ||
const postsInifiniteQuery = useSuspenseInfiniteQuery({ | ||
queryKey: ['posts'], | ||
queryFn: () => getPosts(), | ||
}) | ||
|
||
return <>...</> | ||
} | ||
``` |
31 changes: 31 additions & 0 deletions
31
docs/suspensive.org/src/pages/docs/react-query/usePrefetchInfiniteQuery.ko.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Callout, Sandpack } from '@/components' | ||
|
||
# usePrefetchInfiniteQuery | ||
|
||
usePrefetchInfiniteQuery는 아무것도 반환하지 않으며, useSuspenseInfiniteQuery를 사용하는 컴포넌트를 래핑하는 suspense boundary가 렌더 되기전에 prefetch를 발생시키는 데에 사용합니다. | ||
|
||
```jsx /usePrefetchInfiniteQuery/ | ||
import { usePrefetchInfiniteQuery, useSuspenseInfiniteQuery } from '@suspensive/react-query' | ||
|
||
const PostsPage = ({ postId }) => { | ||
usePrefetchInfiniteQuery({ | ||
queryKey: ['posts'], | ||
queryFn: () => getPosts(), | ||
}) // suspense경계 전에 prefetch를 발생 시키는 데에 사용합니다 | ||
|
||
return ( | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<Posts postId={postId} /> | ||
</Suspense> | ||
) | ||
} | ||
|
||
export const Posts = () => { | ||
const postsInifiniteQuery = useSuspenseInfiniteQuery({ | ||
queryKey: ['posts'], | ||
queryFn: () => getPosts(), | ||
}) | ||
|
||
return <>...</> | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters