code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function updateWorkInProgressHook() {
// This function is used both for updates and for re-renders triggered by a
// render phase update. It assumes there is either a current hook we can
// clone, or a work-in-progress hook from a previous render pass that we can
// use as a base. When we reach the end of the base list, we must switch to
// the dispatcher used for mounts.
var nextCurrentHook;
if (currentHook === null) {
var current = currentlyRenderingFiber$1.alternate;
if (current !== null) {
nextCurrentHook = current.memoizedState;
} else {
nextCurrentHook = null;
}
} else {
nextCurrentHook = currentHook.next;
}
var nextWorkInProgressHook;
if (workInProgressHook === null) {
nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState;
} else {
nextWorkInProgressHook = workInProgressHook.next;
}
if (nextWorkInProgressHook !== null) {
// There's already a work-in-progress. Reuse it.
workInProgressHook = nextWorkInProgressHook;
nextWorkInProgressHook = workInProgressHook.next;
currentHook = nextCurrentHook;
} else {
// Clone from the current hook.
if (nextCurrentHook === null) {
throw new Error('Rendered more hooks than during the previous render.');
}
currentHook = nextCurrentHook;
var newHook = {
memoizedState: currentHook.memoizedState,
baseState: currentHook.baseState,
baseQueue: currentHook.baseQueue,
queue: currentHook.queue,
next: null
};
if (workInProgressHook === null) {
// This is the first hook in the list.
currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook;
} else {
// Append to the end of the list.
workInProgressHook = workInProgressHook.next = newHook;
}
}
return workInProgressHook;
}
|
Warns if there is a duplicate or missing key
|
updateWorkInProgressHook
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function createFunctionComponentUpdateQueue() {
return {
lastEffect: null,
stores: null
};
}
|
Warns if there is a duplicate or missing key
|
createFunctionComponentUpdateQueue
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function basicStateReducer(state, action) {
// $FlowFixMe: Flow doesn't like mixed types
return typeof action === 'function' ? action(state) : action;
}
|
Warns if there is a duplicate or missing key
|
basicStateReducer
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountReducer(reducer, initialArg, init) {
var hook = mountWorkInProgressHook();
var initialState;
if (init !== undefined) {
initialState = init(initialArg);
} else {
initialState = initialArg;
}
hook.memoizedState = hook.baseState = initialState;
var queue = {
pending: null,
interleaved: null,
lanes: NoLanes,
dispatch: null,
lastRenderedReducer: reducer,
lastRenderedState: initialState
};
hook.queue = queue;
var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
return [hook.memoizedState, dispatch];
}
|
Warns if there is a duplicate or missing key
|
mountReducer
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateReducer(reducer, initialArg, init) {
var hook = updateWorkInProgressHook();
var queue = hook.queue;
if (queue === null) {
throw new Error('Should have a queue. This is likely a bug in React. Please file an issue.');
}
queue.lastRenderedReducer = reducer;
var current = currentHook; // The last rebase update that is NOT part of the base state.
var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet.
var pendingQueue = queue.pending;
if (pendingQueue !== null) {
// We have new updates that haven't been processed yet.
// We'll add them to the base queue.
if (baseQueue !== null) {
// Merge the pending queue and the base queue.
var baseFirst = baseQueue.next;
var pendingFirst = pendingQueue.next;
baseQueue.next = pendingFirst;
pendingQueue.next = baseFirst;
}
{
if (current.baseQueue !== baseQueue) {
// Internal invariant that should never happen, but feasibly could in
// the future if we implement resuming, or some form of that.
error('Internal error: Expected work-in-progress queue to be a clone. ' + 'This is a bug in React.');
}
}
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (baseQueue !== null) {
// We have a queue to process.
var first = baseQueue.next;
var newState = current.baseState;
var newBaseState = null;
var newBaseQueueFirst = null;
var newBaseQueueLast = null;
var update = first;
do {
var updateLane = update.lane;
if (!isSubsetOfLanes(renderLanes, updateLane)) {
// Priority is insufficient. Skip this update. If this is the first
// skipped update, the previous update/state is the new base
// update/state.
var clone = {
lane: updateLane,
action: update.action,
hasEagerState: update.hasEagerState,
eagerState: update.eagerState,
next: null
};
if (newBaseQueueLast === null) {
newBaseQueueFirst = newBaseQueueLast = clone;
newBaseState = newState;
} else {
newBaseQueueLast = newBaseQueueLast.next = clone;
} // Update the remaining priority in the queue.
// TODO: Don't need to accumulate this. Instead, we can remove
// renderLanes from the original lanes.
currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane);
markSkippedUpdateLanes(updateLane);
} else {
// This update does have sufficient priority.
if (newBaseQueueLast !== null) {
var _clone = {
// This update is going to be committed so we never want uncommit
// it. Using NoLane works because 0 is a subset of all bitmasks, so
// this will never be skipped by the check above.
lane: NoLane,
action: update.action,
hasEagerState: update.hasEagerState,
eagerState: update.eagerState,
next: null
};
newBaseQueueLast = newBaseQueueLast.next = _clone;
} // Process this update.
if (update.hasEagerState) {
// If this update is a state update (not a reducer) and was processed eagerly,
// we can use the eagerly computed state
newState = update.eagerState;
} else {
var action = update.action;
newState = reducer(newState, action);
}
}
update = update.next;
} while (update !== null && update !== first);
if (newBaseQueueLast === null) {
newBaseState = newState;
} else {
newBaseQueueLast.next = newBaseQueueFirst;
} // Mark that the fiber performed work, but only if the new state is
// different from the current state.
if (!objectIs(newState, hook.memoizedState)) {
markWorkInProgressReceivedUpdate();
}
hook.memoizedState = newState;
hook.baseState = newBaseState;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
} // Interleaved updates are stored on a separate queue. We aren't going to
// process them during this render, but we do need to track which lanes
// are remaining.
var lastInterleaved = queue.interleaved;
if (lastInterleaved !== null) {
var interleaved = lastInterleaved;
do {
var interleavedLane = interleaved.lane;
currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, interleavedLane);
markSkippedUpdateLanes(interleavedLane);
interleaved = interleaved.next;
} while (interleaved !== lastInterleaved);
} else if (baseQueue === null) {
// `queue.lanes` is used for entangling transitions. We can set it back to
// zero once the queue is empty.
queue.lanes = NoLanes;
}
var dispatch = queue.dispatch;
return [hook.memoizedState, dispatch];
}
|
Warns if there is a duplicate or missing key
|
updateReducer
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function rerenderReducer(reducer, initialArg, init) {
var hook = updateWorkInProgressHook();
var queue = hook.queue;
if (queue === null) {
throw new Error('Should have a queue. This is likely a bug in React. Please file an issue.');
}
queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous
// work-in-progress hook.
var dispatch = queue.dispatch;
var lastRenderPhaseUpdate = queue.pending;
var newState = hook.memoizedState;
if (lastRenderPhaseUpdate !== null) {
// The queue doesn't persist past this render pass.
queue.pending = null;
var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next;
var update = firstRenderPhaseUpdate;
do {
// Process this render phase update. We don't have to check the
// priority because it will always be the same as the current
// render's.
var action = update.action;
newState = reducer(newState, action);
update = update.next;
} while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is
// different from the current state.
if (!objectIs(newState, hook.memoizedState)) {
markWorkInProgressReceivedUpdate();
}
hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to
// the base state unless the queue is empty.
// TODO: Not sure if this is the desired semantics, but it's what we
// do for gDSFP. I can't remember why.
if (hook.baseQueue === null) {
hook.baseState = newState;
}
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
|
Warns if there is a duplicate or missing key
|
rerenderReducer
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountMutableSource(source, getSnapshot, subscribe) {
{
return undefined;
}
}
|
Warns if there is a duplicate or missing key
|
mountMutableSource
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateMutableSource(source, getSnapshot, subscribe) {
{
return undefined;
}
}
|
Warns if there is a duplicate or missing key
|
updateMutableSource
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
var fiber = currentlyRenderingFiber$1;
var hook = mountWorkInProgressHook();
var nextSnapshot;
var isHydrating = getIsHydrating();
if (isHydrating) {
if (getServerSnapshot === undefined) {
throw new Error('Missing getServerSnapshot, which is required for ' + 'server-rendered content. Will revert to client rendering.');
}
nextSnapshot = getServerSnapshot();
{
if (!didWarnUncachedGetSnapshot) {
if (nextSnapshot !== getServerSnapshot()) {
error('The result of getServerSnapshot should be cached to avoid an infinite loop');
didWarnUncachedGetSnapshot = true;
}
}
}
} else {
nextSnapshot = getSnapshot();
{
if (!didWarnUncachedGetSnapshot) {
var cachedSnapshot = getSnapshot();
if (!objectIs(nextSnapshot, cachedSnapshot)) {
error('The result of getSnapshot should be cached to avoid an infinite loop');
didWarnUncachedGetSnapshot = true;
}
}
} // Unless we're rendering a blocking lane, schedule a consistency check.
// Right before committing, we will walk the tree and check if any of the
// stores were mutated.
//
// We won't do this if we're hydrating server-rendered content, because if
// the content is stale, it's already visible anyway. Instead we'll patch
// it up in a passive effect.
var root = getWorkInProgressRoot();
if (root === null) {
throw new Error('Expected a work-in-progress root. This is a bug in React. Please file an issue.');
}
if (!includesBlockingLane(root, renderLanes)) {
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
}
} // Read the current snapshot from the store on every render. This breaks the
// normal rules of React, and only works because store updates are
// always synchronous.
hook.memoizedState = nextSnapshot;
var inst = {
value: nextSnapshot,
getSnapshot: getSnapshot
};
hook.queue = inst; // Schedule an effect to subscribe to the store.
mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); // Schedule an effect to update the mutable instance fields. We will update
// this whenever subscribe, getSnapshot, or value changes. Because there's no
// clean-up function, and we track the deps correctly, we can call pushEffect
// directly, without storing any additional state. For the same reason, we
// don't need to set a static flag, either.
// TODO: We can move this to the passive phase once we add a pre-commit
// consistency check. See the next comment.
fiber.flags |= Passive;
pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null);
return nextSnapshot;
}
|
Warns if there is a duplicate or missing key
|
mountSyncExternalStore
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
var fiber = currentlyRenderingFiber$1;
var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the
// normal rules of React, and only works because store updates are
// always synchronous.
var nextSnapshot = getSnapshot();
{
if (!didWarnUncachedGetSnapshot) {
var cachedSnapshot = getSnapshot();
if (!objectIs(nextSnapshot, cachedSnapshot)) {
error('The result of getSnapshot should be cached to avoid an infinite loop');
didWarnUncachedGetSnapshot = true;
}
}
}
var prevSnapshot = hook.memoizedState;
var snapshotChanged = !objectIs(prevSnapshot, nextSnapshot);
if (snapshotChanged) {
hook.memoizedState = nextSnapshot;
markWorkInProgressReceivedUpdate();
}
var inst = hook.queue;
updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); // Whenever getSnapshot or subscribe changes, we need to check in the
// commit phase if there was an interleaved mutation. In concurrent mode
// this can happen all the time, but even in synchronous mode, an earlier
// effect may have mutated the store.
if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
// checking whether we scheduled a subscription effect above.
workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) {
fiber.flags |= Passive;
pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null); // Unless we're rendering a blocking lane, schedule a consistency check.
// Right before committing, we will walk the tree and check if any of the
// stores were mutated.
var root = getWorkInProgressRoot();
if (root === null) {
throw new Error('Expected a work-in-progress root. This is a bug in React. Please file an issue.');
}
if (!includesBlockingLane(root, renderLanes)) {
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
}
}
return nextSnapshot;
}
|
Warns if there is a duplicate or missing key
|
updateSyncExternalStore
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
fiber.flags |= StoreConsistency;
var check = {
getSnapshot: getSnapshot,
value: renderedSnapshot
};
var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
if (componentUpdateQueue === null) {
componentUpdateQueue = createFunctionComponentUpdateQueue();
currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
componentUpdateQueue.stores = [check];
} else {
var stores = componentUpdateQueue.stores;
if (stores === null) {
componentUpdateQueue.stores = [check];
} else {
stores.push(check);
}
}
}
|
Warns if there is a duplicate or missing key
|
pushStoreConsistencyCheck
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {
// These are updated in the passive phase
inst.value = nextSnapshot;
inst.getSnapshot = getSnapshot; // Something may have been mutated in between render and commit. This could
// have been in an event that fired before the passive effects, or it could
// have been in a layout effect. In that case, we would have used the old
// snapsho and getSnapshot values to bail out. We need to check one more time.
if (checkIfSnapshotChanged(inst)) {
// Force a re-render.
forceStoreRerender(fiber);
}
}
|
Warns if there is a duplicate or missing key
|
updateStoreInstance
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function subscribeToStore(fiber, inst, subscribe) {
var handleStoreChange = function () {
// The store changed. Check if the snapshot changed since the last time we
// read from the store.
if (checkIfSnapshotChanged(inst)) {
// Force a re-render.
forceStoreRerender(fiber);
}
}; // Subscribe to the store and return a clean-up function.
return subscribe(handleStoreChange);
}
|
Warns if there is a duplicate or missing key
|
subscribeToStore
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
handleStoreChange = function () {
// The store changed. Check if the snapshot changed since the last time we
// read from the store.
if (checkIfSnapshotChanged(inst)) {
// Force a re-render.
forceStoreRerender(fiber);
}
}
|
Warns if there is a duplicate or missing key
|
handleStoreChange
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function checkIfSnapshotChanged(inst) {
var latestGetSnapshot = inst.getSnapshot;
var prevValue = inst.value;
try {
var nextValue = latestGetSnapshot();
return !objectIs(prevValue, nextValue);
} catch (error) {
return true;
}
}
|
Warns if there is a duplicate or missing key
|
checkIfSnapshotChanged
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function forceStoreRerender(fiber) {
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);
if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
}
}
|
Warns if there is a duplicate or missing key
|
forceStoreRerender
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountState(initialState) {
var hook = mountWorkInProgressHook();
if (typeof initialState === 'function') {
// $FlowFixMe: Flow doesn't like mixed types
initialState = initialState();
}
hook.memoizedState = hook.baseState = initialState;
var queue = {
pending: null,
interleaved: null,
lanes: NoLanes,
dispatch: null,
lastRenderedReducer: basicStateReducer,
lastRenderedState: initialState
};
hook.queue = queue;
var dispatch = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue);
return [hook.memoizedState, dispatch];
}
|
Warns if there is a duplicate or missing key
|
mountState
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateState(initialState) {
return updateReducer(basicStateReducer);
}
|
Warns if there is a duplicate or missing key
|
updateState
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer);
}
|
Warns if there is a duplicate or missing key
|
rerenderState
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function pushEffect(tag, create, destroy, deps) {
var effect = {
tag: tag,
create: create,
destroy: destroy,
deps: deps,
// Circular
next: null
};
var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
if (componentUpdateQueue === null) {
componentUpdateQueue = createFunctionComponentUpdateQueue();
currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
componentUpdateQueue.lastEffect = effect.next = effect;
} else {
var lastEffect = componentUpdateQueue.lastEffect;
if (lastEffect === null) {
componentUpdateQueue.lastEffect = effect.next = effect;
} else {
var firstEffect = lastEffect.next;
lastEffect.next = effect;
effect.next = firstEffect;
componentUpdateQueue.lastEffect = effect;
}
}
return effect;
}
|
Warns if there is a duplicate or missing key
|
pushEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountRef(initialValue) {
var hook = mountWorkInProgressHook();
{
var _ref2 = {
current: initialValue
};
hook.memoizedState = _ref2;
return _ref2;
}
}
|
Warns if there is a duplicate or missing key
|
mountRef
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateRef(initialValue) {
var hook = updateWorkInProgressHook();
return hook.memoizedState;
}
|
Warns if there is a duplicate or missing key
|
updateRef
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
var hook = mountWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
currentlyRenderingFiber$1.flags |= fiberFlags;
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps);
}
|
Warns if there is a duplicate or missing key
|
mountEffectImpl
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
var hook = updateWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
var destroy = undefined;
if (currentHook !== null) {
var prevEffect = currentHook.memoizedState;
destroy = prevEffect.destroy;
if (nextDeps !== null) {
var prevDeps = prevEffect.deps;
if (areHookInputsEqual(nextDeps, prevDeps)) {
hook.memoizedState = pushEffect(hookFlags, create, destroy, nextDeps);
return;
}
}
}
currentlyRenderingFiber$1.flags |= fiberFlags;
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
}
|
Warns if there is a duplicate or missing key
|
updateEffectImpl
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountEffect(create, deps) {
if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
return mountEffectImpl(MountPassiveDev | Passive | PassiveStatic, Passive$1, create, deps);
} else {
return mountEffectImpl(Passive | PassiveStatic, Passive$1, create, deps);
}
}
|
Warns if there is a duplicate or missing key
|
mountEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateEffect(create, deps) {
return updateEffectImpl(Passive, Passive$1, create, deps);
}
|
Warns if there is a duplicate or missing key
|
updateEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountInsertionEffect(create, deps) {
return mountEffectImpl(Update, Insertion, create, deps);
}
|
Warns if there is a duplicate or missing key
|
mountInsertionEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateInsertionEffect(create, deps) {
return updateEffectImpl(Update, Insertion, create, deps);
}
|
Warns if there is a duplicate or missing key
|
updateInsertionEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountLayoutEffect(create, deps) {
var fiberFlags = Update;
{
fiberFlags |= LayoutStatic;
}
if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
fiberFlags |= MountLayoutDev;
}
return mountEffectImpl(fiberFlags, Layout, create, deps);
}
|
Warns if there is a duplicate or missing key
|
mountLayoutEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateLayoutEffect(create, deps) {
return updateEffectImpl(Update, Layout, create, deps);
}
|
Warns if there is a duplicate or missing key
|
updateLayoutEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function imperativeHandleEffect(create, ref) {
if (typeof ref === 'function') {
var refCallback = ref;
var _inst = create();
refCallback(_inst);
return function () {
refCallback(null);
};
} else if (ref !== null && ref !== undefined) {
var refObject = ref;
{
if (!refObject.hasOwnProperty('current')) {
error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}');
}
}
var _inst2 = create();
refObject.current = _inst2;
return function () {
refObject.current = null;
};
}
}
|
Warns if there is a duplicate or missing key
|
imperativeHandleEffect
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountImperativeHandle(ref, create, deps) {
{
if (typeof create !== 'function') {
error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null');
}
} // TODO: If deps are provided, should we skip comparing the ref itself?
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
var fiberFlags = Update;
{
fiberFlags |= LayoutStatic;
}
if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
fiberFlags |= MountLayoutDev;
}
return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
}
|
Warns if there is a duplicate or missing key
|
mountImperativeHandle
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateImperativeHandle(ref, create, deps) {
{
if (typeof create !== 'function') {
error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null');
}
} // TODO: If deps are provided, should we skip comparing the ref itself?
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
}
|
Warns if there is a duplicate or missing key
|
updateImperativeHandle
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountDebugValue(value, formatterFn) {// This hook is normally a no-op.
// The react-debug-hooks package injects its own implementation
// so that e.g. DevTools can display custom hook values.
}
|
Warns if there is a duplicate or missing key
|
mountDebugValue
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountCallback(callback, deps) {
var hook = mountWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
hook.memoizedState = [callback, nextDeps];
return callback;
}
|
Warns if there is a duplicate or missing key
|
mountCallback
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateCallback(callback, deps) {
var hook = updateWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
var prevState = hook.memoizedState;
if (prevState !== null) {
if (nextDeps !== null) {
var prevDeps = prevState[1];
if (areHookInputsEqual(nextDeps, prevDeps)) {
return prevState[0];
}
}
}
hook.memoizedState = [callback, nextDeps];
return callback;
}
|
Warns if there is a duplicate or missing key
|
updateCallback
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountMemo(nextCreate, deps) {
var hook = mountWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
var nextValue = nextCreate();
hook.memoizedState = [nextValue, nextDeps];
return nextValue;
}
|
Warns if there is a duplicate or missing key
|
mountMemo
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
var prevState = hook.memoizedState;
if (prevState !== null) {
// Assume these are defined. If they're not, areHookInputsEqual will warn.
if (nextDeps !== null) {
var prevDeps = prevState[1];
if (areHookInputsEqual(nextDeps, prevDeps)) {
return prevState[0];
}
}
}
var nextValue = nextCreate();
hook.memoizedState = [nextValue, nextDeps];
return nextValue;
}
|
Warns if there is a duplicate or missing key
|
updateMemo
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountDeferredValue(value) {
var hook = mountWorkInProgressHook();
hook.memoizedState = value;
return value;
}
|
Warns if there is a duplicate or missing key
|
mountDeferredValue
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateDeferredValue(value) {
var hook = updateWorkInProgressHook();
var resolvedCurrentHook = currentHook;
var prevValue = resolvedCurrentHook.memoizedState;
return updateDeferredValueImpl(hook, prevValue, value);
}
|
Warns if there is a duplicate or missing key
|
updateDeferredValue
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function rerenderDeferredValue(value) {
var hook = updateWorkInProgressHook();
if (currentHook === null) {
// This is a rerender during a mount.
hook.memoizedState = value;
return value;
} else {
// This is a rerender during an update.
var prevValue = currentHook.memoizedState;
return updateDeferredValueImpl(hook, prevValue, value);
}
}
|
Warns if there is a duplicate or missing key
|
rerenderDeferredValue
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateDeferredValueImpl(hook, prevValue, value) {
var shouldDeferValue = !includesOnlyNonUrgentLanes(renderLanes);
if (shouldDeferValue) {
// This is an urgent update. If the value has changed, keep using the
// previous value and spawn a deferred render to update it later.
if (!objectIs(value, prevValue)) {
// Schedule a deferred render
var deferredLane = claimNextTransitionLane();
currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, deferredLane);
markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent
// from the latest value. The name "baseState" doesn't really match how we
// use it because we're reusing a state hook field instead of creating a
// new one.
hook.baseState = true;
} // Reuse the previous value
return prevValue;
} else {
// This is not an urgent update, so we can use the latest value regardless
// of what it is. No need to defer it.
// However, if we're currently inside a spawned render, then we need to mark
// this as an update to prevent the fiber from bailing out.
//
// `baseState` is true when the current value is different from the rendered
// value. The name doesn't really match how we use it because we're reusing
// a state hook field instead of creating a new one.
if (hook.baseState) {
// Flip this back to false.
hook.baseState = false;
markWorkInProgressReceivedUpdate();
}
hook.memoizedState = value;
return value;
}
}
|
Warns if there is a duplicate or missing key
|
updateDeferredValueImpl
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function startTransition(setPending, callback, options) {
var previousPriority = getCurrentUpdatePriority();
setCurrentUpdatePriority(higherEventPriority(previousPriority, ContinuousEventPriority));
setPending(true);
var prevTransition = ReactCurrentBatchConfig$2.transition;
ReactCurrentBatchConfig$2.transition = {};
var currentTransition = ReactCurrentBatchConfig$2.transition;
{
ReactCurrentBatchConfig$2.transition._updatedFibers = new Set();
}
try {
setPending(false);
callback();
} finally {
setCurrentUpdatePriority(previousPriority);
ReactCurrentBatchConfig$2.transition = prevTransition;
{
if (prevTransition === null && currentTransition._updatedFibers) {
var updatedFibersCount = currentTransition._updatedFibers.size;
if (updatedFibersCount > 10) {
warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
}
currentTransition._updatedFibers.clear();
}
}
}
}
|
Warns if there is a duplicate or missing key
|
startTransition
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountTransition() {
var _mountState = mountState(false),
isPending = _mountState[0],
setPending = _mountState[1]; // The `start` method never changes.
var start = startTransition.bind(null, setPending);
var hook = mountWorkInProgressHook();
hook.memoizedState = start;
return [isPending, start];
}
|
Warns if there is a duplicate or missing key
|
mountTransition
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateTransition() {
var _updateState = updateState(),
isPending = _updateState[0];
var hook = updateWorkInProgressHook();
var start = hook.memoizedState;
return [isPending, start];
}
|
Warns if there is a duplicate or missing key
|
updateTransition
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function rerenderTransition() {
var _rerenderState = rerenderState(),
isPending = _rerenderState[0];
var hook = updateWorkInProgressHook();
var start = hook.memoizedState;
return [isPending, start];
}
|
Warns if there is a duplicate or missing key
|
rerenderTransition
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getIsUpdatingOpaqueValueInRenderPhaseInDEV() {
{
return isUpdatingOpaqueValueInRenderPhase;
}
}
|
Warns if there is a duplicate or missing key
|
getIsUpdatingOpaqueValueInRenderPhaseInDEV
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function mountId() {
var hook = mountWorkInProgressHook();
var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we
// should do this in Fiber, too? Deferring this decision for now because
// there's no other place to store the prefix except for an internal field on
// the public createRoot object, which the fiber tree does not currently have
// a reference to.
var identifierPrefix = root.identifierPrefix;
var id;
if (getIsHydrating()) {
var treeId = getTreeId(); // Use a captial R prefix for server-generated ids.
id = ':' + identifierPrefix + 'R' + treeId; // Unless this is the first id at this level, append a number at the end
// that represents the position of this useId hook among all the useId
// hooks for this fiber.
var localId = localIdCounter++;
if (localId > 0) {
id += 'H' + localId.toString(32);
}
id += ':';
} else {
// Use a lowercase r prefix for client-generated ids.
var globalClientId = globalClientIdCounter++;
id = ':' + identifierPrefix + 'r' + globalClientId.toString(32) + ':';
}
hook.memoizedState = id;
return id;
}
|
Warns if there is a duplicate or missing key
|
mountId
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function updateId() {
var hook = updateWorkInProgressHook();
var id = hook.memoizedState;
return id;
}
|
Warns if there is a duplicate or missing key
|
updateId
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function dispatchReducerAction(fiber, queue, action) {
{
if (typeof arguments[3] === 'function') {
error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().');
}
}
var lane = requestUpdateLane(fiber);
var update = {
lane: lane,
action: action,
hasEagerState: false,
eagerState: null,
next: null
};
if (isRenderPhaseUpdate(fiber)) {
enqueueRenderPhaseUpdate(queue, update);
} else {
var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
entangleTransitionUpdate(root, queue, lane);
}
}
markUpdateInDevTools(fiber, lane);
}
|
Warns if there is a duplicate or missing key
|
dispatchReducerAction
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function dispatchSetState(fiber, queue, action) {
{
if (typeof arguments[3] === 'function') {
error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().');
}
}
var lane = requestUpdateLane(fiber);
var update = {
lane: lane,
action: action,
hasEagerState: false,
eagerState: null,
next: null
};
if (isRenderPhaseUpdate(fiber)) {
enqueueRenderPhaseUpdate(queue, update);
} else {
var alternate = fiber.alternate;
if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) {
// The queue is currently empty, which means we can eagerly compute the
// next state before entering the render phase. If the new state is the
// same as the current state, we may be able to bail out entirely.
var lastRenderedReducer = queue.lastRenderedReducer;
if (lastRenderedReducer !== null) {
var prevDispatcher;
{
prevDispatcher = ReactCurrentDispatcher$1.current;
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
}
try {
var currentState = queue.lastRenderedState;
var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute
// it, on the update object. If the reducer hasn't changed by the
// time we enter the render phase, then the eager state can be used
// without calling the reducer again.
update.hasEagerState = true;
update.eagerState = eagerState;
if (objectIs(eagerState, currentState)) {
// Fast path. We can bail out without scheduling React to re-render.
// It's still possible that we'll need to rebase this update later,
// if the component re-renders for a different reason and by that
// time the reducer has changed.
// TODO: Do we still need to entangle transitions in this case?
enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane);
return;
}
} catch (error) {// Suppress the error. It will throw again in the render phase.
} finally {
{
ReactCurrentDispatcher$1.current = prevDispatcher;
}
}
}
}
var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
entangleTransitionUpdate(root, queue, lane);
}
}
markUpdateInDevTools(fiber, lane);
}
|
Warns if there is a duplicate or missing key
|
dispatchSetState
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function isRenderPhaseUpdate(fiber) {
var alternate = fiber.alternate;
return fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1;
}
|
Warns if there is a duplicate or missing key
|
isRenderPhaseUpdate
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function enqueueRenderPhaseUpdate(queue, update) {
// This is a render phase update. Stash it in a lazily-created map of
// queue -> linked list of updates. After this render pass, we'll restart
// and apply the stashed updates on top of the work-in-progress hook.
didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
var pending = queue.pending;
if (pending === null) {
// This is the first update. Create a circular list.
update.next = update;
} else {
update.next = pending.next;
pending.next = update;
}
queue.pending = update;
} // TODO: Move to ReactFiberConcurrentUpdates?
|
Warns if there is a duplicate or missing key
|
enqueueRenderPhaseUpdate
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function entangleTransitionUpdate(root, queue, lane) {
if (isTransitionLane(lane)) {
var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they
// must have finished. We can remove them from the shared queue, which
// represents a superset of the actually pending lanes. In some cases we
// may entangle more than we need to, but that's OK. In fact it's worse if
// we *don't* entangle when we should.
queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes.
var newQueueLanes = mergeLanes(queueLanes, lane);
queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if
// the lane finished since the last time we entangled it. So we need to
// entangle it again, just to be sure.
markRootEntangled(root, newQueueLanes);
}
}
|
Warns if there is a duplicate or missing key
|
entangleTransitionUpdate
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markUpdateInDevTools(fiber, lane, action) {
{
markStateUpdateScheduled(fiber, lane);
}
}
|
Warns if there is a duplicate or missing key
|
markUpdateInDevTools
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
warnInvalidContextAccess = function () {
error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
}
|
Warns if there is a duplicate or missing key
|
warnInvalidContextAccess
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
warnInvalidHookAccess = function () {
error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks');
}
|
Warns if there is a duplicate or missing key
|
warnInvalidHookAccess
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function Component(props, context, updater) {
this.props = props;
this.context = context; // If a component has string refs, we will assign a different object later.
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
|
Base class helpers for the updating state of a component.
|
Component
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
defineDeprecationWarning = function (methodName, info) {
Object.defineProperty(Component.prototype, methodName, {
get: function () {
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
return undefined;
}
});
}
|
Deprecated APIs. These APIs used to exist on classic React classes but since
we would like to deprecate them, we're not going to move them over to this
modern base class. Instead, we define a getter that warns if it's accessed.
|
defineDeprecationWarning
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function PureComponent(props, context, updater) {
this.props = props;
this.context = context; // If a component has string refs, we will assign a different object later.
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
}
|
Convenience component with default shallow equality check for sCU.
|
PureComponent
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function createRef() {
var refObject = {
current: null
};
{
Object.seal(refObject);
}
return refObject;
}
|
Convenience component with default shallow equality check for sCU.
|
createRef
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function isArray(a) {
return isArrayImpl(a);
}
|
Convenience component with default shallow equality check for sCU.
|
isArray
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function typeName(value) {
{
// toStringTag is needed for namespaced types like Temporal.Instant
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
return type;
}
} // $FlowFixMe only called in DEV, so void return is not possible.
|
Convenience component with default shallow equality check for sCU.
|
typeName
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function willCoercionThrow(value) {
{
try {
testStringCoercion(value);
return false;
} catch (e) {
return true;
}
}
}
|
Convenience component with default shallow equality check for sCU.
|
willCoercionThrow
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function testStringCoercion(value) {
// If you ended up here by following an exception call stack, here's what's
// happened: you supplied an object or symbol value to React (as a prop, key,
// DOM attribute, CSS property, string ref, etc.) and when React tried to
// coerce it to a string using `'' + value`, an exception was thrown.
//
// The most common types that will cause this exception are `Symbol` instances
// and Temporal objects like `Temporal.Instant`. But any object that has a
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
// exception. (Library authors do this to prevent users from using built-in
// numeric operators like `+` or comparison operators like `>=` because custom
// methods are needed to perform accurate arithmetic or comparison.)
//
// To fix the problem, coerce this object or symbol value to a string before
// passing it to React. The most reliable way is usually `String(value)`.
//
// To find which value is throwing, check the browser or debugger console.
// Before this exception was thrown, there should be `console.error` output
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
// problem and how that type was used: key, atrribute, input value prop, etc.
// In most cases, this console output also shows the component and its
// ancestor components where the exception happened.
//
// eslint-disable-next-line react-internal/safe-string-coercion
return '' + value;
}
|
Convenience component with default shallow equality check for sCU.
|
testStringCoercion
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function checkKeyStringCoercion(value) {
{
if (willCoercionThrow(value)) {
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
}
}
}
|
Convenience component with default shallow equality check for sCU.
|
checkKeyStringCoercion
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function getWrappedName(outerType, innerType, wrapperName) {
var displayName = outerType.displayName;
if (displayName) {
return displayName;
}
var functionName = innerType.displayName || innerType.name || '';
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
Convenience component with default shallow equality check for sCU.
|
getWrappedName
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function getContextName(type) {
return type.displayName || 'Context';
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
Convenience component with default shallow equality check for sCU.
|
getContextName
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function getComponentNameFromType(type) {
if (type == null) {
// Host root, text node or just invalid type.
return null;
}
{
if (typeof type.tag === 'number') {
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
}
}
if (typeof type === 'function') {
return type.displayName || type.name || null;
}
if (typeof type === 'string') {
return type;
}
switch (type) {
case REACT_FRAGMENT_TYPE:
return 'Fragment';
case REACT_PORTAL_TYPE:
return 'Portal';
case REACT_PROFILER_TYPE:
return 'Profiler';
case REACT_STRICT_MODE_TYPE:
return 'StrictMode';
case REACT_SUSPENSE_TYPE:
return 'Suspense';
case REACT_SUSPENSE_LIST_TYPE:
return 'SuspenseList';
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_CONTEXT_TYPE:
var context = type;
return getContextName(context) + '.Consumer';
case REACT_PROVIDER_TYPE:
var provider = type;
return getContextName(provider._context) + '.Provider';
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, 'ForwardRef');
case REACT_MEMO_TYPE:
var outerName = type.displayName || null;
if (outerName !== null) {
return outerName;
}
return getComponentNameFromType(type.type) || 'Memo';
case REACT_LAZY_TYPE:
{
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
return getComponentNameFromType(init(payload));
} catch (x) {
return null;
}
}
// eslint-disable-next-line no-fallthrough
}
}
return null;
}
|
Convenience component with default shallow equality check for sCU.
|
getComponentNameFromType
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function hasValidRef(config) {
{
if (hasOwnProperty.call(config, 'ref')) {
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
|
Convenience component with default shallow equality check for sCU.
|
hasValidRef
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function hasValidKey(config) {
{
if (hasOwnProperty.call(config, 'key')) {
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
|
Convenience component with default shallow equality check for sCU.
|
hasValidKey
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function defineKeyPropWarningGetter(props, displayName) {
var warnAboutAccessingKey = function () {
{
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, 'key', {
get: warnAboutAccessingKey,
configurable: true
});
}
|
Convenience component with default shallow equality check for sCU.
|
defineKeyPropWarningGetter
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
warnAboutAccessingKey = function () {
{
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
}
}
|
Convenience component with default shallow equality check for sCU.
|
warnAboutAccessingKey
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function defineRefPropWarningGetter(props, displayName) {
var warnAboutAccessingRef = function () {
{
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, 'ref', {
get: warnAboutAccessingRef,
configurable: true
});
}
|
Convenience component with default shallow equality check for sCU.
|
defineRefPropWarningGetter
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
warnAboutAccessingRef = function () {
{
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
}
}
|
Convenience component with default shallow equality check for sCU.
|
warnAboutAccessingRef
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function warnIfStringRefCannotBeAutoConverted(config) {
{
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
if (!didWarnAboutStringRefs[componentName]) {
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
didWarnAboutStringRefs[componentName] = true;
}
}
}
}
|
Convenience component with default shallow equality check for sCU.
|
warnIfStringRefCannotBeAutoConverted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
{
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
}); // self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
}); // Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
}
|
Factory method to create a new React element. This no longer adheres to
the class pattern, so do not use new to call it. Also, instanceof check
will not work. Instead test $$typeof field against Symbol.for('react.element') to check
if something is a React Element.
@param {*} type
@param {*} props
@param {*} key
@param {string|object} ref
@param {*} owner
@param {*} self A *temporary* helper to detect places where `this` is
different from the `owner` when React.createElement is called, so that we
can warn. We want to get rid of owner and replace string `ref`s with arrow
functions, and as long as `this` and owner are the same, there will be no
change in behavior.
@param {*} source An annotation object (added by a transpiler or otherwise)
indicating filename, line number, and/or other information.
@internal
|
ReactElement
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function createElement(type, config, children) {
var propName; // Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
if (hasValidRef(config)) {
ref = config.ref;
{
warnIfStringRefCannotBeAutoConverted(config);
}
}
if (hasValidKey(config)) {
{
checkKeyStringCoercion(config.key);
}
key = '' + config.key;
}
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
} // Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
{
if (Object.freeze) {
Object.freeze(childArray);
}
}
props.children = childArray;
} // Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
{
if (key || ref) {
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
}
|
Create and return a new ReactElement of the given type.
See https://reactjs.org/docs/react-api.html#createelement
|
createElement
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function cloneAndReplaceKey(oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
}
|
Create and return a new ReactElement of the given type.
See https://reactjs.org/docs/react-api.html#createelement
|
cloneAndReplaceKey
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function cloneElement(element, config, children) {
if (element === null || element === undefined) {
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
}
var propName; // Original props are copied
var props = assign({}, element.props); // Reserved names are extracted
var key = element.key;
var ref = element.ref; // Self is preserved since the owner is preserved.
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source; // Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (hasValidRef(config)) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner.current;
}
if (hasValidKey(config)) {
{
checkKeyStringCoercion(config.key);
}
key = '' + config.key;
} // Remaining properties override existing props
var defaultProps;
if (element.type && element.type.defaultProps) {
defaultProps = element.type.defaultProps;
}
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
if (config[propName] === undefined && defaultProps !== undefined) {
// Resolve default props
props[propName] = defaultProps[propName];
} else {
props[propName] = config[propName];
}
}
}
} // Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
}
|
Clone and return a new ReactElement using element as the starting point.
See https://reactjs.org/docs/react-api.html#cloneelement
|
cloneElement
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function isValidElement(object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
|
Verifies the object is a ReactElement.
See https://reactjs.org/docs/react-api.html#isvalidelement
@param {?object} object
@return {boolean} True if `object` is a ReactElement.
@final
|
isValidElement
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = key.replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
}
|
Escape and wrap key so it is safe to use as a reactid
@param {string} key to be escaped.
@return {string} the escaped key.
|
escape
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function escapeUserProvidedKey(text) {
return text.replace(userProvidedKeyEscapeRegex, '$&/');
}
|
TODO: Test that a single child and an array with one item have the same key
pattern.
|
escapeUserProvidedKey
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function getElementKey(element, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (typeof element === 'object' && element !== null && element.key != null) {
// Explicit key
{
checkKeyStringCoercion(element.key);
}
return escape('' + element.key);
} // Implicit key determined by the index in the set
return index.toString(36);
}
|
Generate a key string that identifies a element within a set.
@param {*} element A element that could contain a manual key.
@param {number} index Index that is used if a manual key is not provided.
@return {string}
|
getElementKey
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
var invokeCallback = false;
if (children === null) {
invokeCallback = true;
} else {
switch (type) {
case 'string':
case 'number':
invokeCallback = true;
break;
case 'object':
switch (children.$$typeof) {
case REACT_ELEMENT_TYPE:
case REACT_PORTAL_TYPE:
invokeCallback = true;
}
}
}
if (invokeCallback) {
var _child = children;
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows:
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
if (isArray(mappedChild)) {
var escapedChildKey = '';
if (childKey != null) {
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
}
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
return c;
});
} else if (mappedChild != null) {
if (isValidElement(mappedChild)) {
{
// The `if` statement here prevents auto-disabling of the safe
// coercion ESLint rule, so we must manually disable it below.
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
checkKeyStringCoercion(mappedChild.key);
}
}
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
// eslint-disable-next-line react-internal/safe-string-coercion
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
}
array.push(mappedChild);
}
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getElementKey(child, i);
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
}
} else {
var iteratorFn = getIteratorFn(children);
if (typeof iteratorFn === 'function') {
var iterableChildren = children;
{
// Warn about using Maps as children
if (iteratorFn === iterableChildren.entries) {
if (!didWarnAboutMaps) {
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
}
didWarnAboutMaps = true;
}
}
var iterator = iteratorFn.call(iterableChildren);
var step;
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getElementKey(child, ii++);
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
}
} else if (type === 'object') {
// eslint-disable-next-line react-internal/safe-string-coercion
var childrenString = String(children);
throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
}
}
return subtreeCount;
}
|
Generate a key string that identifies a element within a set.
@param {*} element A element that could contain a manual key.
@param {number} index Index that is used if a manual key is not provided.
@return {string}
|
mapIntoArray
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
var count = 0;
mapIntoArray(children, result, '', '', function (child) {
return func.call(context, child, count++);
});
return result;
}
|
Maps children that are typically specified as `props.children`.
See https://reactjs.org/docs/react-api.html#reactchildrenmap
The provided mapFunction(child, index) will be called for each
leaf child.
@param {?*} children Children tree container.
@param {function(*, int)} func The map function.
@param {*} context Context for mapFunction.
@return {object} Object containing the ordered map of results.
|
mapChildren
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function countChildren(children) {
var n = 0;
mapChildren(children, function () {
n++; // Don't return anything
});
return n;
}
|
Count the number of children that are typically specified as
`props.children`.
See https://reactjs.org/docs/react-api.html#reactchildrencount
@param {?*} children Children tree container.
@return {number} The number of children.
|
countChildren
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function forEachChildren(children, forEachFunc, forEachContext) {
mapChildren(children, function () {
forEachFunc.apply(this, arguments); // Don't return anything.
}, forEachContext);
}
|
Iterates through children that are typically specified as `props.children`.
See https://reactjs.org/docs/react-api.html#reactchildrenforeach
The provided forEachFunc(child, index) will be called for each
leaf child.
@param {?*} children Children tree container.
@param {function(*, int)} forEachFunc
@param {*} forEachContext Context for forEachContext.
|
forEachChildren
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function toArray(children) {
return mapChildren(children, function (child) {
return child;
}) || [];
}
|
Flatten a children object (typically specified as `props.children`) and
return an array with appropriately re-keyed children.
See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
toArray
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function onlyChild(children) {
if (!isValidElement(children)) {
throw new Error('React.Children.only expected to receive a single React element child.');
}
return children;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
onlyChild
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function createContext(defaultValue) {
// TODO: Second argument used to be an optional `calculateChangedBits`
// function. Warn to reserve for future use?
var context = {
$$typeof: REACT_CONTEXT_TYPE,
// As a workaround to support multiple concurrent renderers, we categorize
// some renderers as primary and others as secondary. We only expect
// there to be two concurrent renderers at most: React Native (primary) and
// Fabric (secondary); React DOM (primary) and React ART (secondary).
// Secondary renderers store their context values on separate fields.
_currentValue: defaultValue,
_currentValue2: defaultValue,
// Used to track how many concurrent renderers this context currently
// supports within in a single renderer. Such as parallel server rendering.
_threadCount: 0,
// These are circular
Provider: null,
Consumer: null,
// Add these to use same hidden class in VM as ServerContext
_defaultValue: null,
_globalName: null
};
context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
_context: context
};
var hasWarnedAboutUsingNestedContextConsumers = false;
var hasWarnedAboutUsingConsumerProvider = false;
var hasWarnedAboutDisplayNameOnConsumer = false;
{
// A separate object, but proxies back to the original context object for
// backwards compatibility. It has a different $$typeof, so we can properly
// warn for the incorrect usage of Context as a Consumer.
var Consumer = {
$$typeof: REACT_CONTEXT_TYPE,
_context: context
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
Object.defineProperties(Consumer, {
Provider: {
get: function () {
if (!hasWarnedAboutUsingConsumerProvider) {
hasWarnedAboutUsingConsumerProvider = true;
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
}
return context.Provider;
},
set: function (_Provider) {
context.Provider = _Provider;
}
},
_currentValue: {
get: function () {
return context._currentValue;
},
set: function (_currentValue) {
context._currentValue = _currentValue;
}
},
_currentValue2: {
get: function () {
return context._currentValue2;
},
set: function (_currentValue2) {
context._currentValue2 = _currentValue2;
}
},
_threadCount: {
get: function () {
return context._threadCount;
},
set: function (_threadCount) {
context._threadCount = _threadCount;
}
},
Consumer: {
get: function () {
if (!hasWarnedAboutUsingNestedContextConsumers) {
hasWarnedAboutUsingNestedContextConsumers = true;
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
}
return context.Consumer;
}
},
displayName: {
get: function () {
return context.displayName;
},
set: function (displayName) {
if (!hasWarnedAboutDisplayNameOnConsumer) {
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
hasWarnedAboutDisplayNameOnConsumer = true;
}
}
}
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
context.Consumer = Consumer;
}
{
context._currentRenderer = null;
context._currentRenderer2 = null;
}
return context;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
createContext
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function lazyInitializer(payload) {
if (payload._status === Uninitialized) {
var ctor = payload._result;
var thenable = ctor(); // Transition to the next state.
// This might throw either because it's missing or throws. If so, we treat it
// as still uninitialized and try again next time. Which is the same as what
// happens if the ctor or any wrappers processing the ctor throws. This might
// end up fixing it if the resolution was a concurrency bug.
thenable.then(function (moduleObject) {
if (payload._status === Pending || payload._status === Uninitialized) {
// Transition to the next state.
var resolved = payload;
resolved._status = Resolved;
resolved._result = moduleObject;
}
}, function (error) {
if (payload._status === Pending || payload._status === Uninitialized) {
// Transition to the next state.
var rejected = payload;
rejected._status = Rejected;
rejected._result = error;
}
});
if (payload._status === Uninitialized) {
// In case, we're still uninitialized, then we're waiting for the thenable
// to resolve. Set it as pending in the meantime.
var pending = payload;
pending._status = Pending;
pending._result = thenable;
}
}
if (payload._status === Resolved) {
var moduleObject = payload._result;
{
if (moduleObject === undefined) {
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
}
}
{
if (!('default' in moduleObject)) {
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
}
}
return moduleObject.default;
} else {
throw payload._result;
}
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
lazyInitializer
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function lazy(ctor) {
var payload = {
// We use these fields to store the result.
_status: Uninitialized,
_result: ctor
};
var lazyType = {
$$typeof: REACT_LAZY_TYPE,
_payload: payload,
_init: lazyInitializer
};
{
// In production, this would just set it on the object.
var defaultProps;
var propTypes; // $FlowFixMe
Object.defineProperties(lazyType, {
defaultProps: {
configurable: true,
get: function () {
return defaultProps;
},
set: function (newDefaultProps) {
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
defaultProps = newDefaultProps; // Match production behavior more closely:
// $FlowFixMe
Object.defineProperty(lazyType, 'defaultProps', {
enumerable: true
});
}
},
propTypes: {
configurable: true,
get: function () {
return propTypes;
},
set: function (newPropTypes) {
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
propTypes = newPropTypes; // Match production behavior more closely:
// $FlowFixMe
Object.defineProperty(lazyType, 'propTypes', {
enumerable: true
});
}
}
});
}
return lazyType;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
lazy
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function forwardRef(render) {
{
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
} else if (typeof render !== 'function') {
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
} else {
if (render.length !== 0 && render.length !== 2) {
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
}
}
if (render != null) {
if (render.defaultProps != null || render.propTypes != null) {
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
}
}
}
var elementType = {
$$typeof: REACT_FORWARD_REF_TYPE,
render: render
};
{
var ownName;
Object.defineProperty(elementType, 'displayName', {
enumerable: false,
configurable: true,
get: function () {
return ownName;
},
set: function (name) {
ownName = name; // The inner component shouldn't inherit this display name in most cases,
// because the component may be used elsewhere.
// But it's nice for anonymous functions to inherit the name,
// so that our component-stack generation logic will display their frames.
// An anonymous function generally suggests a pattern like:
// React.forwardRef((props, ref) => {...});
// This kind of inner function is not used elsewhere so the side effect is okay.
if (!render.name && !render.displayName) {
render.displayName = name;
}
}
});
}
return elementType;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
forwardRef
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function isValidElementType(type) {
if (typeof type === 'string' || typeof type === 'function') {
return true;
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
return true;
}
}
return false;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
isValidElementType
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function memo(type, compare) {
{
if (!isValidElementType(type)) {
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
}
}
var elementType = {
$$typeof: REACT_MEMO_TYPE,
type: type,
compare: compare === undefined ? null : compare
};
{
var ownName;
Object.defineProperty(elementType, 'displayName', {
enumerable: false,
configurable: true,
get: function () {
return ownName;
},
set: function (name) {
ownName = name; // The inner component shouldn't inherit this display name in most cases,
// because the component may be used elsewhere.
// But it's nice for anonymous functions to inherit the name,
// so that our component-stack generation logic will display their frames.
// An anonymous function generally suggests a pattern like:
// React.memo((props) => {...});
// This kind of inner function is not used elsewhere so the side effect is okay.
if (!type.name && !type.displayName) {
type.displayName = name;
}
}
});
}
return elementType;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
memo
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function resolveDispatcher() {
var dispatcher = ReactCurrentDispatcher.current;
{
if (dispatcher === null) {
error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
}
} // Will result in a null access error if accessed outside render phase. We
// intentionally don't throw our own error because this is in a hot path.
// Also helps ensure this is inlined.
return dispatcher;
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
resolveDispatcher
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function useContext(Context) {
var dispatcher = resolveDispatcher();
{
// TODO: add a more generic warning for invalid values.
if (Context._context !== undefined) {
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
// and nobody should be using this in existing code.
if (realContext.Consumer === Context) {
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
} else if (realContext.Provider === Context) {
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
}
}
}
return dispatcher.useContext(Context);
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
useContext
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function useState(initialState) {
var dispatcher = resolveDispatcher();
return dispatcher.useState(initialState);
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
useState
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
function useReducer(reducer, initialArg, init) {
var dispatcher = resolveDispatcher();
return dispatcher.useReducer(reducer, initialArg, init);
}
|
Returns the first child in a collection of children and verifies that there
is only one child in the collection.
See https://reactjs.org/docs/react-api.html#reactchildrenonly
The current implementation of this function assumes that a single child gets
passed without a wrapper, but the purpose of this helper function is to
abstract away the particular structure of children.
@param {?object} children Child collection structure.
@return {ReactElement} The first and only `ReactElement` contained in the
structure.
|
useReducer
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.