Reducer (React)

In React, a reducer refers to a function that takes in two arguments, a state value followed by an action, and returns a new state after processing the one provided to it along with the dispatched action.

More details

Here's the general form of a reducer function in React:

function reducer(state, action) {
   // Process state depending upon the action,
   // and then return a new state.
}

state is the state of a React component while action is an object representing an occurred action/event in the app.