dispatch function

The function returned by useReducer that sends an action to the reducer and schedules a re-render with the result.

In more detail

React guarantees the dispatch function keeps the same identity for the life of the component, so it can be passed to children or context without memoization and without causing re-renders. You call it from event handlers, never during rendering.

Example

dispatch({ type: "FETCH_START" })

Related terms

Taught in

References