3 ms·
Use react-hyperscript [0] instead. I'm not sure if it's yet been updated to support createFactory, but even if it doesn't you could create a simple higher orde
by malandrew 12y ago
Use react-hyperscript [0] instead.
I'm not sure if it's yet been updated to support createFactory, but even if it doesn't you could create a simple higher order function the partially applies the static unchanging DOM parts, returning a function that takes the same data type as the function returned by createFactory.
IMHO, with createFactory, there is no longer a good justification for JSX. JSX basically solves a problem that JSX created. The reason people like JSX is that it takes the unchanging DOM structure (basically the virtual DOM equivalent of HTML templating) and puts it in HTML like templates do. This gives it a sufficiently different syntax, that it's easy to visually discern the changing parts from the unchanging parts, especially with syntax highlighting support. However, with createFactory, you have a way to wrap up all the unchanging structure, such that you don't have to constantly have to mentally parse the unchanging structure from the virtual DOM that render() is actually going to update. This means you still have to deal with React.DOM, but if you use react-hyperscript, the syntax is sufficiently simplified that it's comparable to HTML.
The complexity of JSX simply isn't worth it. It breaks too many tools.
[0] https://github.com/mlmorg/react-hyperscript https://github.com/mlmorg/react-hyperscript