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

Function mountState

docs/external/js/react-dom.development.js:15352–15369  ·  view source on GitHub ↗
(initialState)

Source from the content-addressed store, hash-verified

15350 }
15351
15352 function mountState(initialState) {
15353 var hook = mountWorkInProgressHook();
15354
15355 if (typeof initialState === 'function') {
15356 // $FlowFixMe: Flow doesn't like mixed types
15357 initialState = initialState();
15358 }
15359
15360 hook.memoizedState = hook.baseState = initialState;
15361 var queue = hook.queue = {
15362 pending: null,
15363 dispatch: null,
15364 lastRenderedReducer: basicStateReducer,
15365 lastRenderedState: initialState
15366 };
15367 var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
15368 return [hook.memoizedState, dispatch];
15369 }
15370
15371 function updateState(initialState) {
15372 return updateReducer(basicStateReducer);

Callers 3

mountDeferredValueFunction · 0.85
mountTransitionFunction · 0.85

Calls 1

mountWorkInProgressHookFunction · 0.85

Tested by

no test coverage detected