DomPart? tore State const todos = [{ ids, description: "Go to gym" MM id: 2, description: "Eat food” ui Component function todoComponent(todo) { const div = document.createElement("di Projects | 100x005 const hl = document.createglement("h'’); const button = document.createElement("button’); button.innerHTML = "Delete"; hLinnerHTML = todo.title; div.appendChild(hl); div.appendChild(button); Linkedin Topbar State const state = { notifications: { home: 0, -ntps:ifprojects.100xdevs.com/patidom-2iDOM Part 21 m8‘224, 290M Projects | 100:00re messaging: 0, ~ 5 DOMPart2 1of8 profilePicture: "https://media.licdn.com/dms/image/v2/C5603AQFbOqG90g } Components es , Started code
v Approach #1 - Clean the screen everytime we re-render Suny ra rue 7syuivs -ntps:ifprojects.100xdevs.com/patidom-2iDOM Part 21 ona‘224, 290M Projects | 100:00re g There is a better approach —- You find the diff and only do deletes / updates / additions that are necessary. But that'll boggle most folks heads so we're not going there. The general goal should be to minimize the number of interactions in the DOM. React does this by using something called the virtual DOM, -ntps:ifprojects.100xdevs.com/patidom-2iDOM Part 21 sone‘112824, 9:30 AM Projects | 100xDevs “44 TANO functionality = DOMPart2 1of8 Lets add the functionality to 1. Add more TODOs 2. Delete functionality g You only need to update state and call the render function. You Dont need to do the actual DOM manipulations, the render function will do it for you. Y Solution
-ntps:ifprojects.100xdevs.com/patidom-2iDOM Part 21 saneYou might also like