This project offers a simplified React reconciliation algorithm demonstration within a dynamic Todo List application. It highlights diff calculation and DOM manipulation for element addition, update, and removal, mirroring React and ReactDOM's core functions.
git clone https://github.com/starvader13/Reconciler-Using-DOM.git
cd Reconciler-Using-DOM/backend
npm install
nodemon server.js
Open the frontend/index.html
file in a web browser to interact with the application. The frontend will automatically fetch updates from the backend every 5 seconds, reflecting any changes in the todo list.
project-root
├── backend
│ └── server.js # Node.js server that generates random todos
├── frontend
│ ├── index.html # Main HTML file with a div container for todos
│ └── script.js # Contains logic for DOM updates and state management
└── README.md # Documentation of the project
The backend is a HTTP express server that simulates a dynamic source of todo items, each represented with a title
, description
, and id
.
index.html
: A singlediv
element with the idtodos
acts as the container for dynamically added todo elements.script.js
:- Reconciliation and State Management: The
updateState
function inscript.js
showcases a simplified version of React's reconciliation process, managing state transitions and efficient DOM updates. - DOM Operations: Functions
addTodoToDom
,removeTodoFromDom
, andupdateTodoInDom
provide insights into manual DOM manipulation strategies, forming the basis for understanding frameworks like React.
- Reconciliation and State Management: The