Skip to content

Instantly share code, notes, and snippets.

@Tevinthuku
Created August 22, 2019 10:53
Show Gist options
  • Save Tevinthuku/e16770b4a09f67c0a6a2e982f8c11fe5 to your computer and use it in GitHub Desktop.
Save Tevinthuku/e16770b4a09f67c0a6a2e982f8c11fe5 to your computer and use it in GitHub Desktop.
//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