mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
Fix Persist in TypeScript Usage on readme (#1193)
* Fix Persist example in Typescript Persist middleware requires the name option to keep storage unique. See https://github.com/pmndrs/zustand/blob/main/docs/persisting-store-data.md#name This change adds the 'name' option to the Typescript Usage example to update it. Additionally, the persist example already has this required option. * run prettier on file
This commit is contained in:
parent
75d0886cd6
commit
f0b6023ece
13
readme.md
13
readme.md
@ -461,10 +461,15 @@ interface BearState {
|
||||
|
||||
const useBearStore = create<BearState>()(
|
||||
devtools(
|
||||
persist((set) => ({
|
||||
bears: 0,
|
||||
increase: (by) => set((state) => ({ bears: state.bears + by })),
|
||||
}))
|
||||
persist(
|
||||
(set) => ({
|
||||
bears: 0,
|
||||
increase: (by) => set((state) => ({ bears: state.bears + by })),
|
||||
}),
|
||||
{
|
||||
name: 'bear-storage',
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user