This documentation is for the old Kea 1.0. To see the latest docs, click here!

createAction

Create actions which you can use in your kea reducers.

Usage

import { createAction } from 'kea'

const newAction = createAction('description', (id, value) => ({ id, value }))

const someLogic = kea({
  actions: () => ({
    myAction: true
  }),

  reducers: ({ actions }) => ({
    myValue: [false, PropTypes.bool,
      [actions.myAction]: () => true,
      [newAction]: () => false
    ]
  })
})

// somewhere else
store.dispatch(newAction(12, 'bla'))