4 ms·
I'm disappointed that JSX is now so coupled to React. I was looking forward to JSX being used by many different JavaScript frameworks[1], but this change reveal
by simplify 12y ago
I'm disappointed that JSX is now so coupled to React. I was looking forward to JSX being used by many different JavaScript frameworks[1], but this change reveals the devs are not interested in moving that direction.
[1] Example: https://github.com/mrsweaters/mithril-rails https://github.com/mrsweaters/mithril-rails
- spicyj 12y agoWe do actually want JSX to be flexible and usable for not just React, which is why we're trying to write a formal specification of the syntax with multiple parser implementations: http://facebook.github.io/jsx/ http://facebook.github.io/jsx/ We intentionally don't specify semantics to give different transpilers the flexibility to compile the JSX into whatever's appropriate for the library you're using.
- sebmarkbage 12y agoYea, note that mithril is on that list. The syntax was where people unified. There wasn't agreement on semantics and this is moving closer to that. It's possible that this will eventually unify again. E.g. around a replacement for an object literal. E.g. a standard record type.
- simplify 12y agoA specification is great, and I'm happy to see that. However, even though it's true that transpilers can compile JSX with arbitrary semantics, it still requires writing your own transpiler. JSX is a great syntax, and these changes mean nothing if you're a transpiler writer. What I was hoping for was the JSX transpiler that React uses would become flexible enough for any library to use, without the need to modify/rewrite the transpiler itself. Yes it's possible for someone else to write something like this, but writing a compiler is no small feat =/
- malandrew 12y agoJSX is a great syntax It's really not. It's just mixing syntaxes to solve the problem that mixed syntaxes causes. Higher order functions (i.e. createFactory) is a much better solution.
- mehh 12y agoReact looks interesting JSX does not. I was considering using React for my next project , but I really do not want JSX or Coffescript or any of this other crap. Dojo suffered terribly by having a split brain, I think you guys a following a well worn path. I don't care if JSX is this or that, I simply have no interest in using or learning it because its not significant enough nor applicable outside of your framework and enforces anyone else who I work with to also adopt it. This isn't just my opinion, having discussed using React this was the general consensus in a team of very different people, I stated that its fine because you don'e need to use JSX ... but at the moment it looks like you are focusing on moving developers in the direction we don't want to go.
- malandrew 12y agoUse 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