4 ms·
It seems like you didnt actually look at the code because thats exactly what its doing: https://github.com/1Marc/todomvc-vanillajs-2022/blob/main/js/app.js#L82
by chacham15 4y ago
It seems like you didnt actually look at the code because thats exactly what its doing: https://github.com/1Marc/todomvc-vanillajs-2022/blob/main/js/app.js#L82 https://github.com/1Marc/todomvc-vanillajs-2022/blob/main/js... it clears innerHTML there and then rerenders the children
- ricardobeat 4y agoYou’re right, I did a quick reading and thought it was updating elements one by one. I still suspect this might be faster than React anyway. Would be interesting to try.
- SemanticStrengh 4y agoRight but proper manual dom is generally faster than optimized react code. That does not means that in general manual dom code is proper.
- 1marc 4y agoI did this style to mimick modern framework code — taking the state (todos) and render the state of the world every time. If the browser had a DOM diffing api this would be more efficient and we would be there. So for a larger project I might using something like Lit’s html stand-alone package or fastdom to get the DOM digging functionality without much dependency code.