News for hackers. Stuff that matters.
Re:TodoMVC App Written in Vanilla JavaScript by dymk on Saturday May 07, 2022 @01:27PM (#31296638)
No, the reason React has a VDOM is because the DOM is slow to update, compared to manipulating javascript objects. It's worthwhile to calculate the list of minimum updates ahead of time rather than using the DOM as the source of truth.

Not sure where you think mutation comes into play here, that's an orthogonal concern—you can have an API that mutates some internal representation of a VDOM, and it's still faster than manipulating the DOM directly.

Re:TodoMVC App Written in Vanilla JavaScript by recursive on Saturday May 07, 2022 @03:15PM (#31297612)
In order to achieve immutability, large chunks of state have to be cloned whenever a single value changes. This sometimes causes a whole new DOM node to be created during reconciliation. React encourages you not to think about it too much. But some nodes can't be replaced. Like canvas or anything contentEditable. It's not orthogonal. It's a direct consequence of the design philosophy.