mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
docs(typescript): supplement the missing ) symbol in the combine code example (#1082)
* docs(typescript): supplement the missing `)` symbol in the `combine` code example * style(docs/typescript): formatting
This commit is contained in:
parent
c0e074f19a
commit
85a5959a2d
@ -118,12 +118,14 @@ And now `T` gets inferred and you get to annotate `E` too. Zustand has the same
|
||||
Alternatively you can also use `combine` which infers the state instead of you having to type it...
|
||||
|
||||
```ts
|
||||
import create from "zustand"
|
||||
import { combine } from "zustand/middleware"
|
||||
import create from 'zustand'
|
||||
import { combine } from 'zustand/middleware'
|
||||
|
||||
const useStore = create(combine({ bears: 0 }, (set) => ({
|
||||
increase: (by: number) => set((state) => ({ bears: state.bears + by })),
|
||||
}))
|
||||
const useStore = create(
|
||||
combine({ bears: 0 }, (set) => ({
|
||||
increase: (by: number) => set((state) => ({ bears: state.bears + by })),
|
||||
}))
|
||||
)
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user