Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix document error of persist with hydration #1758

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/integrations/persisting-store-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ In some applications you may need to control when the first hydration occurs.
For example, in server-rendered apps.

If you set `skipHydration`, the initial call for hydration isn't called,
and it is left up to you to manually call `reHydrate()`.
and it is left up to you to manually call `rehydrate()`.

```ts
export const useBoundStore = create(
Expand All @@ -291,12 +291,12 @@ export const useBoundStore = create(
```

```tsx
export function StoreConsumer(){
const store = useBoundStore();
import { useBoundStore } from './path-to-store';

export function StoreConsumer() {
// hydrate persisted store after on mount
useEffect(() => {
store.persist.reHydrate();
useBoundStore.persist.rehydrate();
}, [])

return (
Expand Down