-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Customizable JSX/TSX mode #5546
Comments
There are more and more frameworks using JSX coming up, i.e. https://github.com/garbles/yolk. So this would be very useful. |
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.
|
@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?) 🌹 |
To follow up on this issue. this issue has been discussed |
sorry hit comment too soon. this issue has been discussed in #3788. you can find the current decesion at: #6146 (comment) with #6146, anything more involved will need to wait for #5595. this issue seems to be a duplicate of #3788 and is fixed by #6146 now. |
We currently have two
jsx
modes,preserve
andreact
. Usingpreserve
leaves the<Something />
for an additional compilation step, andreact
ties you into using theReact
library. I want to propose a compiler option which allows you to define the emitted types. For example setting:Which would transform this code:
Into this result:
Essentially, replacing
React.createElement
withel
. Now I can define anel
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 asvirtual-hyperscript
(perhaps with some minor modifications there).The text was updated successfully, but these errors were encountered: