Support for non-JSX render functions
Opened this issue · 5 comments
OliverJAsh commented
Hi!
I just wondered if you had thought of also supporting non-JSX usages of React, where object/function identity is still a performance concern?
Thanks,
Oliver
OliverJAsh commented
We could also consider extending scope from objects/functions inside JSX to the whole render function, so this would error:
const MyComponent = () => {
const toObject = { pathname: '/foo' };
return <Link to={toObject}>foo</Link>;
};
cvazac commented
Yes! That was always part of the plan. Let me know if you are interested in contributing.
OliverJAsh commented
@cvazac Is that yes to both ideas?
- Support non-JSX usages, e.g.
React.createElement(MyComponent, { objectProp: {} })
- Support usages outside of virtual DOM but inside render functions
cvazac commented
I think both are important, but I'd prioritize 2 over 1. I had always planned to (attempt to) read more of the scope.
We report on:
render() {
return <Tag obj={{}} />
}
But it's easily defeated with:
render() {
var o = {}
return <Tag obj={o} />
}
OliverJAsh commented
@cvazac If it's OK with you, I'll open another issue to track 2, as I originally created this issue to track 1.