You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have two jsx modes, preserve and react. Using preserve leaves the <Something /> for an additional compilation step, and react ties you into using the React library. I want to propose a compiler option which allows you to define the emitted types. For example setting:
"jsx": {createElement: "el"}
Which would transform this code:
let test = <div><span /><span /></div>;
Into this result:
var test = el("div", null, el("span", null), el("span", null));
Essentially, replacing React.createElement with el. Now I can define an el function like:
To implement an own library. Why? Because some of us don't like being forced into using React, and this would allow us to either create our own libraries or use an existing DSL such as virtual-hyperscript (perhaps with some minor modifications there).
Yes, I want this feature. However, not all library have same convention like react. So, simple renaming createElement to "el" name like Deathspike example will not work for some library.
Gigih Aji Ibrahim (@bungcip) : As a quick workaround you can wrap the JSX -> React.createElement generated js with another runtime javascript function that returns an object literal of the desired structure (or am I wrong?) 🌹
Activity
Lenne231 commentedon Nov 22, 2015
There are more and more frameworks using JSX coming up, i.e. https://github.com/garbles/yolk. So this would be very useful.
bungcip commentedon Jan 13, 2016
Yes, I want this feature. However, not all library have same convention like react. So, simple renaming createElement to "el" name like Deathspike example will not work for some library.
msx (https://github.com/insin/msx) will transform
to like this.
basarat commentedon Jan 13, 2016
Gigih Aji Ibrahim (@bungcip) : As a quick workaround you can wrap the JSX -> React.createElement generated js with another runtime javascript function that returns an object literal of the desired structure (or am I wrong?) 🌹
mhegazy commentedon Jan 13, 2016
To follow up on this issue. this issue has been discussed
mhegazy commentedon Jan 13, 2016
sorry hit comment too soon.
this issue has been discussed in #3788. you can find the current decesion at: #6146 (comment)
with #6146,
--reactNamespaceoption allows you to define alternative JSX factories toReact.anything more involved will need to wait for #5595.
this issue seems to be a duplicate of #3788 and is fixed by #6146 now.