( current: FiberNode, pendingProps: Props )
| 133 | } |
| 134 | |
| 135 | export 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 | |
| 176 | export function createFiberFromElement(element: ReactElementType): FiberNode { |
| 177 | const { type, key, props, ref } = element; |
no outgoing calls
no test coverage detected