Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 476 Bytes

consequence_action_return.md

File metadata and controls

18 lines (13 loc) · 476 Bytes

Action return type

When a consequence returns an object with a key type it will be dispatched instantly:

import {addRule} from 'redux-ruleset'

addRule({
  id: 'PING_PONG',
  target: 'PING',
  consequence: () => ({type: 'PONG'})
})

dispatch({type: 'PING'})
// -> dispatch({ type: 'PONG' })

Important to note is, that the consequence will stay active until the returned action was fully dispatched and all rules related to this action were executed.