New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for <{'Module'} {'key'}={'value'}> #158
Comments
Interpolating the module name seems hard since you don't know whether it's in React.DOM or not and local variables can't be accessed by string name anyway. Also related to #129. |
could be rewritten as
Not sure we want to do it that way but it would work :p |
But I was more thinking about module being a reference to an actual function.
would be rewritten as
|
👍 We've thrown around a couple ideas for being able to forward several properties:
Either way, a couple of interesting questions come up: Does the position of props effect the semantics? Does the order that they are specified effect the precedence?
If so, then would it be transformed into:
I like the end result. The only tradeoff to consider is that now our transform is becoming more than a lightweight, line-for-line, non-opinionated one. It might even depend on some runtime library to do the merging. The |
Get rid of the interpolation in that last example and that's exactly what we have today… if The transform doesn't see something from a hard coded list, it expects a variable in scope. Also, I will say no to any transform that puts You could always do something like this:
|
hides It didn't occur to me that I could just to Christopher "vjeux" Chedeau On Jul 4, 2013, at 1:33 PM, Paul O’Shannessy notifications@github.com wrote:
|
@zpao: There may still be value in allowing interpolation for the tag name, but I don't know how we would enforce that the closing tag matches!
|
@jordwalke There's definitely value, but it comes at the cost of making JSX harder to understand, and I think that cost is too high. And that case is so easily re-written to
that it hardly seems worth any complexity. |
So I am very concerned about adding complexity to JSX just for the sake of syntax. We need to keep it dead simple, IMO, unless we need to add expressive power. I think that forwarding multiple properties is a useful use case, and could be desugared as an extra param to React.DOM.*. |
Let's close this out. If we need special keys we can always fall back to non-JSX. |
Add a stress test for tree traversal
Right now JSX only supports desugaring for value interpolation <Module key={'value'}>. Would be nice to support interpolation for the module name and keys. E4X supports those interpolations.
I would also really like to support interpolation for arbitrary props. This would allow us to get rid of this.transferPropsTo which is a really unfortunate API in my mind.
The text was updated successfully, but these errors were encountered: