Skip to content
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

Variable for React.DOM in jsx compile result #1975

Closed
klimashkin opened this issue Aug 2, 2014 · 2 comments
Closed

Variable for React.DOM in jsx compile result #1975

klimashkin opened this issue Aug 2, 2014 · 2 comments

Comments

@klimashkin
Copy link

Hello!
JSX compile markup into React.DOM.xxx() functions. But when markup is complicated the result become too wordy, because of repeating React.DOM
It would be greate to refer to React.DOM in variable, for example, within compiled render method

  • It would be more performance because of less object property lookup
  • It would be better minified
@syranide
Copy link
Contributor

syranide commented Aug 2, 2014

I'm not saying you're wrong, but I think in real-life scenarios that both of those become close to immeasurable. Performance of lookups should be minimal in the scale of things and compression should eliminate the cost of the "wordiness".

So I think there is little pressure to improve this, but I imagine that if you or someone else put the time in to do implement this that it would be greatly appreciated.

@zpao
Copy link
Member

zpao commented Aug 14, 2014

I'm willing to bet a large sum of money that there are more important things to optimize elsewhere in your own code and in React before optimizing the object lookups in React.DOM.*.

JSX complication may change in the future - we've talked about maybe assigning local variables or maybe dropping React.DOM entirely and forcing you to import explicitly. We're not going to put any effort into this right, maybe with recast. I don't think that anybody should spend the time right now, so I'm going to close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants