It's not difficult to find a tool to convert JSX to React.createElement, something like this:
<div className="commentBox">
Hello, world! I am a CommentBox.
</div>
to this:
React.createElement('div', {className: "commentBox"},
"Hello, world! I am a CommentBox."
)
I can't find a tool co make a convertation vice-versa. I have a big codebase with React.createElement, and I want to transform it to plain JSX. How can I do it?
It's a bit of an unusual case, but there is a tool for that: https://www.npmjs.com/package/babel-plugin-transform-react-createelement-to-jsx. It seems to be relatively fresh, so good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With