Skip to content

Commit

Permalink
fix(docs/typescript): provide example how to use middlewares with pmn…
Browse files Browse the repository at this point in the history
  • Loading branch information
holgergp authored Jan 27, 2023
1 parent 1023eb4 commit 04080fd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/guides/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,23 @@ export const BearComponent = () => {
}
```
If you want to use middlewares with your store:
```ts
import { createStore } from 'zustand/vanilla'
import { devtools } from 'zustand/middleware'

export const vanillaBearStore = createStore<BearState>()(
devtools((set, getState) => ({
...initialBearState,
increase: (by) => set((state) => ({ bears: state.bears + by })),
}))
)
```
For more information about why there are extra parentheses,
please see the [Basic usage section](#basic-usage).
## Middlewares and their mutators reference
- `devtools``["zustand/devtools", never]`
Expand Down

0 comments on commit 04080fd

Please sign in to comment.