Skip to content

Instantly share code, notes, and snippets.

@Tevinthuku

Tevinthuku/fiber.js

Created Aug 22, 2019
Embed
What would you like to do?
//NB: ALL DOM nodes have their corresponding fibers in our new implementation
// most of this properties will make sense once we begin using them
let fiber = {
tag: HOST_COMPONENT, // we can have either host of class component
type: "input",
parent: parentFiber, // the parentNode’s fiber
child: childFiber, // the childNode’s fiber if it has any
sibling: null, // the element that is in the same tree level as this input
alternate: currentFiber, // the fiber that has been rendered on the dom. Will be null if its on initial render
stateNode: document.createElement(“div”),
props: { children: [], id: "image", type: "text"},
effectTag: PLACEMENT,// can either be PLACEMENT | DELETION | UPDATe depending on the dom operation to be done
effects: [] // this array will contain fibers of its childComponent
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment