Settable
The value passed to store.setState()
and store.setStateDeep()
, thus also the value passed to instance.setState()
and instance.setStateDeep()
.
Definition
type Settable<State = any> = ((state: State) => State) | State
Can be either the state straight-up or a function that receives the current state and returns the new state
const store = createStore(null, 'initial state')
store.setState('new state')
store.setState(currentState => `${currentState} and then some`)
store.getState() // 'new state and then some'