Uh oh!
There was an error while loading. Please reload this page.
Support for other JSX factories - #6146
Conversation
- added jsxNamespace compile option - when jsx mode is "react", jsxNamespace optionally specifies the emit namespace for React calls, eg "--jsxNamespace MyDOMLib" will emit calls as MyDOMLib.createElement (instead of React.createElement) - symbol specified by jsxNamespace must be present, else compile error is generated (same handling as is done for React symbol when no jsxNamespace is specified)
Hi Rowan Wyborn (@rwyborn), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
Ryan Cavanaugh (RyanCavanaugh)
commented
Dec 18, 2015
I think we need to tweak the naming a bit here. This change is still very useful but doesn't directly address #3788 because it still requires that the library have the same shape ( I'm thinking: letx=<Foo/>;
|
If you have |
Homa Wong (unional)
commented
Dec 18, 2015
I would suggest to "pollute the global" with a meaningful namespace, such as |
Rowan Wyborn (rwyborn)
commented
Dec 18, 2015
Ryan Cavanaugh (@RyanCavanaugh) I had exactly the same thought originally re: your --jsx make example. The problem is this doesn't define what to do with the JSX spread handling, which emits a call to React.__spread. So my compromise was to let the namespace be configured instead, ie --jsxNamespace MyDOMHandler emits
Client code can then map those to whatever custom library implementation it wants. |
Tingan Ho (tinganho)
commented
Dec 19, 2015
What about?
I think the option |
Ryan Cavanaugh (RyanCavanaugh)
commented
Jan 6, 2016
Sorry for the delay. Discussed with Bill Ticehurst (@billti) and Mohamed Hegazy (@mhegazy) and we landed on the following
The only change I'd like to see here (other than removal of merge conflicts 😉) is that Thanks! |
Mohamed Hegazy (mhegazy)
commented
Jan 7, 2016
Rowan Wyborn (@rwyborn) please change the option name to |
Mohamed Hegazy (mhegazy)
commented
Jan 7, 2016
merged manually after updating the name and adding tests. |
Mohamed Hegazy (mhegazy)
commented
Jan 7, 2016
thanks Rowan Wyborn (@rwyborn)! |
Rowan Wyborn (rwyborn)
commented
Jan 8, 2016
Mohamed Hegazy (@mhegazy) I just got back from holiday, thanks for fixing this up! |
Homa Wong (unional)
commented
Nov 21, 2016
How is that doing? |
Mohamed Hegazy (mhegazy)
commented
Nov 21, 2016
Homa Wong (@unional) looks like you are looking for #12135 |
Homa Wong (unional)
commented
Nov 21, 2016
Thank! I'll take a look at it. It's been a while ago, I need to refresh what is my original needs. 🌷 |
PR for Issue #3788
Current implementation adds a new jsxNamespace compile option that can specify the JSX namespace (factory) when jsx mode is react.
--jsx react --jsxNamespace MyDOMLib
results in emits being MyDOMLib.createElement
I was thinking an alternative would be to just use the existing --jsx option where "preserve" and "react" are special reserved values. In this setup the above would be achieved by just doing
-- jsx MyDOMLib