useReducer<State extends Object, Action> function

Store<State, Action> useReducer <State extends Object, Action>(
  1. Reducer<State, Action> reducer,
  2. {State initialState,
  3. Action initialAction}
)

An alternative to useState for more complex states.

useReducer manages an read only state that can be updated by dispatching actions which are interpreted by a Reducer.

reducer is immediatly called on first build with initialAction and initialState as parameter.

It is possible to change the reducer by calling useReducer with a new Reducer.

See also:

Implementation

Store<State, Action> useReducer<State extends Object, Action>(
  Reducer<State, Action> reducer, {
  State initialState,
  Action initialAction,
}) {
  return use(_ReducerdHook(reducer,
      initialAction: initialAction, initialState: initialState));
}