useReducer<State extends Object, Action> function

Store<State, Action> useReducer <State extends Object, Action>(Reducer<State, Action> reducer, { State initialState, 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:


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