Electron, create-react-app, and Reach Router in harmony. Starter project is intended to be minimal yet cover key integration scenarios. Bootstrap is used as the UI framework.
For development, start the following in separate terminals:
# start React dev server (open in terminal 1)
yarn dev:react
# start Electron app (open in terminal 2)
yarn dev:main
For prod, run:
# build react app
yarn build
# start Electron and load prod react app
yarn start
Main process is launched via main.js
and accepts a command-line argument to override start url for the main window. See dev:main
npm script which loads the local webpack dev server at http://localhost:3000.
Render process loads a web page created by create-react-app for a config-less and familiar React environment. At dev-time, the Webpack dev server is used, at run-time, the built site is used.
Routing within the app is done using Reach Router. The main tweak was to use url hash history and LocationProvider to enable routing when loading index.html
from the file system.
Renderer process connects with the main process using contextBridge.