How to use React JSX with Babel in Electron
Issue #352
For a normal electron app created with npm init
, we can use all features of ES6, but not the JSX syntax for React. We can use just Babel to transpile JSX, as used in IconGenerator
.babelrc
1 | { |
And in package.json
, call babel to transpile src
to dist
1 | "main": "dist/main.js", |
Remember to use dist/main.js
as our starting point, and in index.html, specify ./dist/renderer.js
1 | <body> |