Overview

Purpose

The reducer is what you pass to the useReducer hook in React, to Redux's createStore, or to any other function that takes a function of the (prevState, action) => newState signature.

In useRiducer

useRiducer returns a { state, dispatch, actions } object where the dispatch function updates state on the basis of Riduce-standard actions produced by actions, using a riduce-produced reducer under-the-hood.

In riduce

riduce returns a [reducer, actions] pair because the reducer is wired up to precisely listen to the Riduce-standard actions produced by actions.