Transpile your mithril jsx using babel's online transpiler



You can transpile your JSX based mithril component to mithril component online with help of babeljs.


Goto https://babeljs.io/repl




Copy your JSX component over there.




Select React and ES2015 in preset for compilation.




You will be getting compiled code on the right side.






If you notice this compiled code is for React, and not for the mithril.
You have to go one step more, Replace all the React.createElement with m and you got the code for your mithril.


Repalce react.createElement with m

Cheers!




Comments