Objective Redux

Redux made better, objectively.

createAction

function createAction<Payload>(type: string): (payload: Payload) => Action<Payload>

Returns a function that generates a Redux action of the form { type, payload }.
This is particularly useful for code-splitting or for firing actions to non-Objective Redux reducers.

Template Parameters

<Payload>

Parameters

type: string
The name of the action being sent.

Returns

(payload: Payload) => Action
The action generating function.

Examples

// To fire an action to a reducer not managed by Objective Redux
const action = createAction('myAction');

// To fire an action to an Objective Redux controller without using the controller
const action = createAction(getActionNameForController('myControllerName', 'myActionName'));