Skip to content

codeashdev/Rereact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rereact

The code uses a reconciliation algorithm to update the virtual DOM and a work loop to perform the updates. It also uses a fiber tree to represent the virtual DOM, with each fiber node containing information about its type, props, children, and the real DOM node it represents.

Here is a brief overview of the code:

createElement: a function that creates a virtual DOM element with a type, props, and children.
createDom: a function that creates a real DOM element based on the virtual DOM element provided.
updateDom: a function that updates a real DOM element with the new props.
commitWork: a function that updates or adds real DOM elements to the document.
render: a function that initiates the update process.
performUnitOfWork: a function that performs a unit of work on a fiber (a virtual DOM node).
updateFunctionComponent: a function that updates a fiber representing a function component and its children.
useState: a function that creates a state hook for function components.

Overall, the code is a simplified version of React's core functionality, providing a basic understanding of how React works under the hood.

Releases

No releases published

Packages

No packages published