If my updated element is not the last child, it is pushed to the last due to appendChild. Although we delete the updated element's dom from the parent dom, we are still appending the updated element's dom to the end.
`
In the above case, the span gets appended as the last child of the parent div instead of being the 2nd child when the update becomes true. Should we be using "repalceChild" instead?
If my updated element is not the last child, it is pushed to the last due to appendChild. Although we delete the updated element's dom from the parent dom, we are still appending the updated element's dom to the end.
Eg `
Chapter 4 (Reconciliation)
` In the above case, the span gets appended as the last child of the parent div instead of being the 2nd child when the update becomes true. Should we be using "repalceChild" instead?
I got the same problem here! When append child, we must consider where to place the child