drop(n = 1)

create.drop create(actionType).drop Appropriate leaf state: array

Returns a Riduce-standard action to non-mutatively drop the first n elements from the leaf's state.

Parameters

Returns

action (object): a Riduce-standard action

Example

import { createStore } from 'redux'
import riduce from 'riduce'

const initialState = {
  foo: ['a', 'b', 'c'],
  bar: ['a', 'b', 'c']
}

const [reducer, actions] = riduce(initialState)
const store = createStore(reducer)

No argument provided

const dropFromFoo = actions.foo.create.drop
store.dispatch(dropFromFoo())
console.log(store.getState().foo) // ['b', 'c']

Providing an argument

const dropFromBar = actions.bar.create.drop
store.dispatch(dropFromBar(2))
console.log(store.getState().bar) // ['c']