Tobias Uhlig
2 min readJan 29, 2023

--

Hi Peter,

i actually strongly disagree on this quote. Let me explain: Inside any type of Web Worker, there is no access to the DOM (except for canvas nodes => OffscreenCanvas). Meaning: if you want your components to live within a different thread, there has to be a virtual markup.

Saying “vdom is an anti-pattern” would be the same as saying “frontends have to be single-threaded”.

Now the quote originated from the React ecosystem. I do fully agree that this implementation was not good at all (still kudos for being the first who did it). So what Svelte or Solidjs are doing for the single-threaded realm is definitely an improvement compared to React.

Now inside neo it is a completely different story. This starts with components only needing to call render() once. Let this one sink in a bit. After a component got mounted, we can just change the virtual markup at run-time and we get extremely minimalistic delta updates to the real DOM. Components are not one way tickets, but persistant instances which can update in any way you can think of. The virtual markup is extremly lightweight (nested objects and arrays inside a JSON format) and there is no need to create any kind of instances for it. We can just pass the new and old state to the so called vdom worker and it will figure out the deltas for us.

Maybe we should just rename “VDOM” to something else to avoid this kind of confusion in the future. In case someone has a good idea, I am all yours :)

Best regards,
Tobi

--

--

Responses (1)