top | item 47107353

(no title)

Izkata | 8 days ago

> so either you ask AI to do it

I dunno, AI tools love adding not only useEffect but also unnecessary useMemo.

> I don't know why people think the virtual DOM is a performance boost.

It was advertised as one of the advantages when React was new, due to the diffing browsers would only need to render the parts that changed instead of shoving a whole subtree into the page and the having to do all of it (because remember this came out in the era of jquery and mustachejs generating strings of HTML from templates instead of targeted updates).

discuss

order

MrJohz|7 days ago

Patching the DOM existed long before React, that wasn't a new technique. IIRC, the idea was more that the VDOM helped by making batching easier and reducing layout thrashing, where you write to the DOM (scheduling an asynchronous layout update), read from the DOM (forcing that thenlayout update to be executed synchronously now).

That said, none of that is specific to the VDOM, and I think a lot of the impression that "VDOM = go fast" comes from very early marketing that was later removed. I think also people understand that the VDOM is a lightweight, quick-to-generate version of the DOM, and then assume that the VDOM therefore makes things fast, but forget about (or don't understand) the patching part of React, which is also necessary if you've got a VDOM and which is slow.