reducer action
A plain object describing something that happened, usually with a type string and optional payload data, sent to a reducer through dispatch.
In more detail
By convention the type names the event, such as FETCH_SUCCESS, and the payload carries its data. Describing what happened rather than what to set keeps the update rules inside the reducer.
Example
{ type: "FETCH_SUCCESS", payload: "data" }Related terms
- reducer — A pure function that takes the current state and an action and returns the next state.
- dispatch function — The function returned by useReducer that sends an action to the reducer and schedules a re-render with the result.
- discriminated union — A type made of several object shapes that share one literal field, such as status or type, whose value tells them apart.
Taught in
- Complex State with useReducer: State Machines And Action Types — React 19 & Modern Component Architecture