createAction
// JavaScript
function createAction(type)// TypeScript
function createAction<T extends string | symbol | number>(
type: T
): BasicActionCreator<T>Details
TypeScript Notes
const incrementBy = createAction('incrementBy').withPayload<number>();if (incrementBy.matches(action)) { const amount = action.payload // Type is inferred to be `number` due to matches() }
Examples
See Also
Last updated