react-magic icon indicating copy to clipboard operation
react-magic copied to clipboard

Consider going straight to React syntax

Open ssorallen opened this issue 10 years ago • 3 comments

The JSX transformer is designed to take string input in a certain syntax and convert it to React syntax. However, htmltojsx.js does not work with strings: it works with a DOM tree structure. HTMLtoJSX could skip JSX syntax and instead output React.createElement calls, eliminating the need for the JSX transformer.

Is this feasible?

ssorallen avatar Feb 24 '15 15:02 ssorallen

HTMLtoJSX just builds JSX at the moment. It does not use any parts of JSXTransformer. It could definitely be modified to output regular JavaScript rather than JSX. I'll add it as an option. Thanks for the suggestion!

Daniel15 avatar Feb 24 '15 18:02 Daniel15

👍

mummybot avatar May 16 '16 14:05 mummybot

The output of the convert function on my HTML is returning a string -- I suppose this is the intended behavior but I'd ideally like to use the output as raw JSX. Is this possible?

dant00ine avatar Mar 06 '18 03:03 dant00ine