MCPcopy
hub / github.com/facebook/react / useReducer

Function useReducer

packages/react-reconciler/src/ReactFiberHooks.js:4076–4090  ·  view source on GitHub ↗
(
      reducer: (S, A) => S,
      initialArg: I,
      init?: I => S,
    )

Source from the content-addressed store, hash-verified

4074 }
4075 },
4076 useReducer<S, I, A>(
4077 reducer: (S, A) => S,
4078 initialArg: I,
4079 init?: I => S,
4080 ): [S, Dispatch<A>] {
4081 currentHookNameInDev = 'useReducer';
4082 mountHookTypesDev();
4083 const prevDispatcher = ReactSharedInternals.H;
4084 ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV;
4085 try {
4086 return mountReducer(reducer, initialArg, init);
4087 } finally {
4088 ReactSharedInternals.H = prevDispatcher;
4089 }
4090 },
4091 useRef<T>(initialValue: T): {current: T} {
4092 currentHookNameInDev = 'useRef';
4093 mountHookTypesDev();

Callers 5

CounterFunction · 0.50
ComponentFunction · 0.50
AppFunction · 0.50
CounterFunction · 0.50
AppFunction · 0.50

Calls

no outgoing calls

Tested by 5

CounterFunction · 0.40
ComponentFunction · 0.40
AppFunction · 0.40
CounterFunction · 0.40
AppFunction · 0.40