mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
docs(typescript): add recommendation to use devtools after immer (#1198)
* docs(typescript): add recommendation to use `devtools` after `immer` * remove typo * run prettier Co-authored-by: daishi <daishi@axlight.com>
This commit is contained in:
parent
c60a535a46
commit
8e987d99aa
@ -190,6 +190,8 @@ const useBearStore = create<BearState>()(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also it's recommended to use `devtools` middleware as last as possible, in particular after `immer` middleware, ie it should be `immer(devtools(...))` and not `devtools(immer(...))`. The reason being that `devtools` mutates the `setState` and adds a type parameter on it, which could get lost if other middlewares (like `immer`) mutate `setState` before `devtools`.
|
||||||
|
|
||||||
## Authoring middlewares and advanced usage
|
## Authoring middlewares and advanced usage
|
||||||
|
|
||||||
Imagine you had to write this hypothetical middleware...
|
Imagine you had to write this hypothetical middleware...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user