concat(array)
create.concat
create(actionType).concat
Appropriate leaf state: array
Returns a Riduce-standard action to update the leaf's state by concatenating it with array
.
array
(array): the array to concatenateaction
(object): a Riduce-standard action
import { createStore } from 'redux'
import riduce from 'riduce'
const initialState = {
arr: [1, 2, 3],
str: 'foo'
}
const [reducer, actions] = riduce(initialState)
const store = createStore(reducer)
const concatToArr = actions.arr.create.concat
store.dispatch(concatToArr(['a', 'b', 'c']))
console.log(store.getState().arr) // [1, 2, 3, 'a', 'b', 'c']