MCPcopy
hub / github.com/BetaSu/big-react / createWorkInProgress

Function createWorkInProgress

packages/react-reconciler/src/fiber.ts:135–174  ·  view source on GitHub ↗
(
	current: FiberNode,
	pendingProps: Props
)

Source from the content-addressed store, hash-verified

133}
134
135export const createWorkInProgress = (
136 current: FiberNode,
137 pendingProps: Props
138): FiberNode => {
139 let wip = current.alternate;
140 if (wip === null) {
141 // mount
142 wip = new FiberNode(current.tag, pendingProps, current.key);
143 wip.stateNode = current.stateNode;
144
145 wip.alternate = current;
146 current.alternate = wip;
147 } else {
148 // update
149 wip.pendingProps = pendingProps;
150 wip.flags = NoFlags;
151 wip.subtreeFlags = NoFlags;
152 wip.deletions = null;
153 }
154 wip.type = current.type;
155 wip.updateQueue = current.updateQueue;
156 wip.child = current.child;
157 wip.memoizedProps = current.memoizedProps;
158 wip.memoizedState = current.memoizedState;
159 wip.ref = current.ref;
160
161 wip.lanes = current.lanes;
162 wip.childLanes = current.childLanes;
163
164 const currentDeps = current.dependencies;
165 wip.dependencies =
166 currentDeps === null
167 ? null
168 : {
169 lanes: currentDeps.lanes,
170 firstContext: currentDeps.firstContext
171 };
172
173 return wip;
174};
175
176export function createFiberFromElement(element: ReactElementType): FiberNode {
177 const { type, key, props, ref } = element;

Callers 5

useFiberFunction · 0.90
cloneChildFibersFunction · 0.90
prepareFreshStackFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected