| ▲ | spankalee 7 hours ago | |||||||
> There is no DOM primitive that allows for interoperable composition with fine-grained reactivity. Your framework offers fine-grained reactivity (Virtual DOM for React/Preact, signals for Angular, runes for Svelte, etc.) and any component that contains another component has to coordinate with it. This just isn't true - composition and reactivity are completely orthogonal concerns. Any reactivity system can manage DOM outside of the component, including nodes that are projected into slots. The component's internal DOM is managed by the component using whatever reactivity system it desires. There are major applications built this way. They make have a React outer shell using vdom and Lit custom elements using lit-html for their shadow contents. On top of those basics you can also have cross-shadow interoperable fine-grained reactivity with primitives like signals. You can pass signals around, down the tree, across subtrees, and have different reactivity systems use those signals to update the DOM. | ||||||||
| ▲ | dfabulich 6 hours ago | parent [-] | |||||||
You can do it, but that undermines the whole point of React: fine-grained reactivity. If the child component had been a React component instead, the children would have participated in the virtual DOM, and React could do a minimal DOM update when it was done. React can't even see the shadow contents of Lit elements, so React just has to update the light DOM and let Lit take over from there. (Same applies to Vue, Angular, Svelte, Solid, etc. Each framework has a reactivity system, and you have to integrate with it to get its benefits.) | ||||||||
| ||||||||