import type { Fiber } from 'react-reconciler' ; import { findChildFiberAt , findPreviousFiber } from './findFiber' ; param parent param index returns export function removeChildFiberAt ( parent , index ) { if ( index === 0 ) { return removeFirstChildFiber ( parent ) ; } const previousFiber = findChildFiberAt ( parent , index - 1 ) ; if ( previousFiber === null ) { return null ; } return removeSiblingFiber ( previousFiber ) ; } param parent param key returns export function removeChildFiber ( parent , key ) { const previousFiber = findPreviousFiber ( parent , key ) ; if ( previousFiber === null ) { return null ; } if ( previousFiber === parent ) { return removeFirstChildFiber ( parent ) ; } return removeSiblingFiber ( previousFiber ) ; } param parent returns export function removeFirstChildFiber ( parent ) { const removed = parent . child ; if ( removed === null ) { return null ; } parent . child = removed . sibling ; return removed ; } param fiber returns export function removeSiblingFiber ( fiber ) { const removed = fiber . sibling ; if ( removed === null ) { return null ; } fiber . sibling = removed . sibling ; return removed ; }