alex-kinokon / jsx-dom

Use JSX to create DOM elements.
BSD 3-Clause "New" or "Revised" License
278 stars 30 forks source link

React-compatible? #20

Closed dy closed 4 years ago

dy commented 4 years ago

Just curious - if that would be possible to render react components via morphdom/nanomorph with, for example, augmentor for hooks.

alex-kinokon commented 4 years ago

Can you elaborate on this?

dy commented 4 years ago

I wondered if that's possible to make react components work in non-react real-dom world, similar to preact/compat. Because there are many ready react-based solutions - having them available off-react could be usefult, and jsx-dom seems to handle various react-specific jsx cases nicely. It's not feature request, just wanted to know your thoughts on that and/or possible directions of extending/usage. I've come up with unihooks - universal react-less hooks collection, for any framework. So for example if jsx-dom supported hooked components, then unihooks would be available for it too.

alex-kinokon commented 4 years ago

It’s true that jsx-dom aims to be as close to React as possible, but adding general hook support seems to require substantial changes to the codebase and likely triple the code size. If you have any idea how to implement it, please let me know.