4.2 React Foundation
4.2 React Foundation
4.2 React Foundation
getNextPosts
getNextPosts
document.createElement
document.appendChild
element.setAttribute
element.children
https://gist.github.com/hkirat/e61655a7d93ce06810488be402adebee
Let’s try to create a TODO application using DOM manipulation
JS
HTML
Let’s try to create a TODO application using DOM manipulation
Problem with this approach - Very hard to add and remove elements
No central State
State
Let’s try to create a TODO application using DOM manipulation
Fn
Let’s try to create a TODO application using DOM manipulation
Dumb Solution
Fn
https://gist.github.com/hkirat/cb9d7e2f75617ac281427276e20a691c
Let’s try to create a TODO application using DOM manipulation
Better Solution
Don’t clear the DOM upfront, update it based on what has changed.
Better Solution
Don’t clear the DOM upfront, update it based on what has changed.
https://gist.github.com/hkirat/ed34df967f162d152e35537cb8215144
What is the easiest way to create a dynamic frontend website?
1. Update a state variable
2. Delegate the task of guring out di to a hefty function
3. Tell the hefty function how to add, update and remove elements
fi
ff
What is the easiest way to create a dynamic frontend website?
1. Update a state variable
2. Delegate the task of guring out di to a hefty function
3. Tell the hefty function how to add, update and remove elements
fi
ff
What is the easiest way to create a dynamic frontend website?
1. Update a state variable
2. Delegate the task of guring out di to a hefty function
3. Tell the hefty function how to add, update and remove elements
fi
ff
What is the easiest way to create a dynamic frontend website?
1. Update a state variable
2. Delegate the task of guring out di to a hefty function
3. Tell the hefty function how to add, update and remove elements
fi
ff
Usually done by the FE developer