React
How to create an Electron app with React and Electron Forge
Adding React support to the Webpack template doesn't require a complicated boilerplate to get started.
The following guide has been tested with React 18, Babel 7, and Webpack 5.
Create the app and setup the Webpack config
Create the app with the Webpack template. Add the following packages to your devDependencies
so that JSX and other React features can be used properly:
Set up the babel-loader
module with the React preset in webpack.rules.js
:
webpack.rules.js
Add the React dependencies
Add the basic React packages to your dependencies
:
Integrate React code
You should now be able to start writing and using React components in your Electron app. The following is a very minimal example of how to start to add React code:
For more about React, see their documentation.
Last updated