Skip to content
Myr

docs(README): remove 'omit' in 'Overwriting state' section (#3160)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* docs(README): replace 'lodash' with 'es-toolkit' in 'Overwriting state' section * docs(README): change 'es-tooklit/compat' to 'es-toolkit/compat/omit' * docs(README): replace 'es-toolkit' with custom 'omit' implementation * docs(README): remove 'omit' util function * docs(README): simplify 'deleteTuna'

authored by Wonsuk Choi · committed by GitHub · parent 5bc717b · Browse files · 1 file+1 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−3 removed

  • other:+1 added−3 removed

1 file+1 added−3 removed

modified:README.md+1 added-3 removed
123 unmodified lines
124125The `set` function has a second argument, `false` by default. Instead of merging, it will replace the state model. Be careful not to wipe out parts you rely on, like actions.126127```jsx128import omit from 'lodash-es/omit'129128const useFishStore = create((set) => ({129 salmon: 1,130 tuna: 2,131 deleteEverything: () => set({}, true), // clears the entire store, actions included134 deleteTuna: () => set((state) => omit(state, ['tuna']), true),132 deleteTuna: () => set(({ tuna, ...rest }) => rest, true),133}))134```135136## Async actions
370 unmodified lines