sokra / rawact

[POC] A babel plugin which compiles React.js components into native DOM instructions to eliminate the need for the react library at runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why no progress on this POC?

jayarjo opened this issue · comments

Well, I think this is so complex because with React you have a lot of syntax sugar and ways to handle components dynamically. The reason this approach worked so well with Svelte is that it is built on top of a templating language and that makes the implementation a lot simpler and safer. I'm missing something @Rich-Harris?

It's complicated because React's update model is based on recreating everything. Someone would need to isolate the update path from the create path through static analysis. That being said Hooks probably make this easier. The lynch point comes into deciding how to handle the view logic without just replacing all new DOM nodes every time. This can be handled with clever memoization. It doesn't need to be VDOM level. You can do it in a single pass by storing any conditional values and using a list reconcilliation algorithm similar to what you'd find in a library like lit-html or Svelte.

In any case not sure if this porject is still allive but someone else is trying to take a crack at it here: https://github.com/mohebifar/vidact