MCPcopy Create free account
hub / github.com/microsoft/SandDance / mountReducer

Function mountReducer

docs/external/js/react-dom.development.js:15151–15170  ·  view source on GitHub ↗
(reducer, initialArg, init)

Source from the content-addressed store, hash-verified

15149 }
15150
15151 function mountReducer(reducer, initialArg, init) {
15152 var hook = mountWorkInProgressHook();
15153 var initialState;
15154
15155 if (init !== undefined) {
15156 initialState = init(initialArg);
15157 } else {
15158 initialState = initialArg;
15159 }
15160
15161 hook.memoizedState = hook.baseState = initialState;
15162 var queue = hook.queue = {
15163 pending: null,
15164 dispatch: null,
15165 lastRenderedReducer: reducer,
15166 lastRenderedState: initialState
15167 };
15168 var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
15169 return [hook.memoizedState, dispatch];
15170 }
15171
15172 function updateReducer(reducer, initialArg, init) {
15173 var hook = updateWorkInProgressHook();

Callers 1

Calls 2

mountWorkInProgressHookFunction · 0.85
initFunction · 0.50

Tested by

no test coverage detected