News for hackers. Stuff that matters.
Re:TodoMVC App Written in Vanilla JavaScript by chacham15 on Saturday May 07, 2022 @11:02AM (#31295058)
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... it clears innerHTML there and then rerenders the children
Re:TodoMVC App Written in Vanilla JavaScript by SemanticStrengh on Saturday May 07, 2022 @11:18AM (#31295223)
Right but proper manual dom is generally faster than optimized react code. That does not means that in general manual dom code is proper.
Re:TodoMVC App Written in Vanilla JavaScript by 1marc on Saturday May 07, 2022 @12:10PM (#31295823)
I 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.
Re:TodoMVC App Written in Vanilla JavaScript by ricardobeat on Saturday May 07, 2022 @11:05AM (#31295094)
You’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.