increment(n = 1)
create.increment
create(actionType).increment
Appropriate leaf state: number
Returns a Riduce-standard action to increment the leaf's state by n
.
n
(number, optional): the number to increment the leaf's state by, defaulting to 1action
(object): a Riduce-standard action
import { createStore } from 'redux'
import riduce from 'riduce'
const initialState = {
foo: 5,
bar: 5
}
const [reducer, actions] = riduce(initialState)
const store = createStore(reducer)
const incrementFoo = actions.foo.create.increment
store.dispatch(incrementFoo())
console.log(store.getState().foo) // 6
const incrementBar = actions.bar.create.increment
store.dispatch(incrementBar(37))
console.log(store.getState().bar) // 42