toggle()create.toggle create(actionType).toggle Appropriate leaf state: boolean
Returns a Riduce-standard action to update the leaf's state to !leafState.
action (object): a Riduce-standard action
import { createStore } from 'redux'
import riduce from 'riduce'
const initialState = {
foo: true,
bar: false
}
const [reducer, actions] = riduce(initialState)
const store = createStore(reducer)
create.toggleconst toggleFoo = actions.foo.create.toggle
store.dispatch(toggleFoo())
console.log(store.getState().foo) // false
create(actionType).toggleconst toggleBar = actions.bar.create('TOGGLE_BAR').toggle
store.dispatch(toggleBar())
console.log(store.getState().bar) // true