mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
docs: fix typos (#3042)
This commit is contained in:
parent
a90981afb5
commit
9ba6a63799
@ -109,7 +109,7 @@ Finally, we combine both components in the `App` component to see them in action
|
|||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UpdateBabyBearPorridge />
|
<UpdateBabyBearMeal />
|
||||||
<BearNames />
|
<BearNames />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@ -186,7 +186,9 @@ the state change:
|
|||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
function BearNames() {
|
function BearNames() {
|
||||||
const names = useBearFamilyStore(useShallow((state) => Object.keys(state)))
|
const names = useBearFamilyMealsStore(
|
||||||
|
useShallow((state) => Object.keys(state)),
|
||||||
|
)
|
||||||
|
|
||||||
return <div>{names.join(', ')}</div>
|
return <div>{names.join(', ')}</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,7 +180,10 @@ const personStore = createStore<PersonStore>()(
|
|||||||
},
|
},
|
||||||
setPerson: (nextPerson) =>
|
setPerson: (nextPerson) =>
|
||||||
set((state) => {
|
set((state) => {
|
||||||
state.person = typeof nextPerson ? nextPerson(state.person) : nextPerson
|
state.person =
|
||||||
|
typeof nextPerson === 'function'
|
||||||
|
? nextPerson(state.person)
|
||||||
|
: nextPerson
|
||||||
}),
|
}),
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user