3 ms·
I'd like to see the transform implemented this way: function foo(props) { return <h1>hi!</ht> } Becomes function foo(jsx) { return fu
by fiddlerwoaroof 6y ago
I'd like to see the transform implemented this way:
function foo(props) {
return <h1>hi!</ht>
}
Becomes
function foo(jsx) {
return function foo(props) {
return jsx.createElement('h1', ...);
}
}
Then, the first time a given component is rendered your view framework injects the right value of "jsx" and caches the resulting Component. This means no static dependencies are necessary to write components for libraries that use JSX.
EDIT: added as comment https://github.com/reactjs/rfcs/pull/107#issuecomment-696978080 https://github.com/reactjs/rfcs/pull/107#issuecomment-696978...