MCPcopy Index your code
hub / github.com/caseywebdev/react-list / mountReducer

Function mountReducer

docs/index.js:24722–24750  ·  view source on GitHub ↗
(reducer, initialArg, init)

Source from the content-addressed store, hash-verified

24720 return "function" === typeof action ? action(state) : action;
24721 }
24722 function mountReducer(reducer, initialArg, init) {
24723 var hook = mountWorkInProgressHook();
24724 if (void 0 !== init) {
24725 var initialState = init(initialArg);
24726 if (shouldDoubleInvokeUserFnsInHooksDEV) {
24727 setIsStrictModeForDevtools(!0);
24728 try {
24729 init(initialArg);
24730 } finally {
24731 setIsStrictModeForDevtools(!1);
24732 }
24733 }
24734 } else initialState = initialArg;
24735 hook.memoizedState = hook.baseState = initialState;
24736 reducer = {
24737 pending: null,
24738 lanes: 0,
24739 dispatch: null,
24740 lastRenderedReducer: reducer,
24741 lastRenderedState: initialState
24742 };
24743 hook.queue = reducer;
24744 reducer = reducer.dispatch = dispatchReducerAction.bind(
24745 null,
24746 currentlyRenderingFiber$1,
24747 reducer
24748 );
24749 return [hook.memoizedState, reducer];
24750 }
24751 function updateReducer(reducer) {
24752 var hook = updateWorkInProgressHook();
24753 return updateReducerImpl(hook, currentHook, reducer);

Callers 1

index.jsFile · 0.85

Calls 2

mountWorkInProgressHookFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…