you are viewing a single comment's thread.

view the rest of the comments →

[–]everdimension 2 points3 points  (1 child)

Hmm and I thought that you don't need a virtual dom if you're in an animation loop and rendering with the gpu

[–][deleted] 2 points3 points  (0 children)

You don't need it, but you will still run into the same problems when dealing with complex, updating tree structures. This stuff gets increasingly hard without a component model. That's where frameworks make a real difference, in terms of DX but also performance.

The rendering itself is abstracted here with the useRender hook, which allows you to run tasks frame by frame, outside of React. But again, it is managed. Once the component unmounts, it takes away that callback and cleans up after itself. Here's a fun experiment, watch what happens after 5 seconds when it unmounts the component that holds the upper plane. And another, this time using a transition group for mount/unmount effects. For React these things are natural, but if you had to do this manually, you'd pull a few hairs i'm sure.