Skip to content

Commit 1d5ba26

Browse files
Docs: update SSR and Query docs to include notes about TS and useHydrateAtom (#2882)
* Add Typescript note to Query Client example * docs: add ts instructions for useHydrateAtoms to query and ssr --------- Co-authored-by: Daishi Kato <[email protected]>
1 parent 7883c4e commit 1d5ba26

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/extensions/query.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ Although they reference methods same query key (`'todos'`), the `onSuccess` inva
263263

264264
This will result in `todosAtom` showing stale data as it was not prompted to refetch.
265265

266+
⚠️ Note: When using **Typescript**, it is recommended to use a Map when passing the queryClient value to useHydrateAtoms. You can find a working example in the [Initializing State on Render docs](https://jotai.org/docs/guides/initialize-atom-on-render#using-typescript)
267+
266268
```jsx
267269
import { Provider } from 'jotai/react'
268270
import { useHydrateAtoms } from 'jotai/react/utils'

docs/utilities/ssr.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ useHydrateAtoms([
9090
] as const)
9191
```
9292

93+
Or you may need to use a Map when passing the atom value to useHydrateAtoms. You can find a working example in the [Initializing State on Render docs](https://jotai.org/docs/guides/initialize-atom-on-render#using-typescript).
94+
9395
### Demo
9496

9597
<Stackblitz id="stackblitz-starters-b7cvxi" file="pages%2Findex.tsx" />

0 commit comments

Comments
 (0)