on()

create.on create(actionType).on Appropriate leaf state: boolean

Returns a Riduce-standard action to update the leaf's state to true.

Returns

action (object): a Riduce-standard action

Example

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

const initialState = {
  foo: false,
  bar: false
}

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

Calling create.on

const turnOffFoo = actions.foo.create.on
store.dispatch(turnOffFoo())
console.log(store.getState().foo) // true

Calling create(actionType).on

const turnOffBar = actions.bar.create('TURN_ON_BAR').on
store.dispatch(turnOffBar())
console.log(store.getState().bar) // ture