DEV Community

Cover image for How to build Electron apps with React.

How to build Electron apps with React.

Wachira on December 28, 2019

Introduction I have always had a deep interest in writing Desktop applications. What was holding me off throughout the years was, I wasn...
Collapse
 
yougotwill profile image
Will G

Just started building a react-electron boilerplate for myself this morning. This post answers all my questions. Thank you πŸ™πŸ™

Collapse
 
wchr profile image
Wachira

Glad to know it helped πŸ˜‰.

Collapse
 
yougotwill profile image
Will G

This might be a noob question but what does the flag combination "-mw" do in "electron-pack": "build -mw" inside the package.json? Did some googling but couldn't find an explanation.

Thread Thread
 
romanpod profile image
Roman Br.

That's for creating Mac and Win executables.

Thread Thread
 
yougotwill profile image
Will G

Awesome that makes sense. Thank you πŸ™

Collapse
 
martinduo profile image
Bruce Martin

I just fixed the problem below by changing script line to this:

"electron-dev": "concurrently \"SET BROWSER=none&&npm run start\" \"wait-on localhost:3000 && electron .\""

This answer was found on stackoverflow.com/questions/587363...

Collapse
 
martinduo profile image
Bruce Martin

I began your instructions and when I got to "Let's run our app" with yarn electron-dev, what I got was this:

$ concurrently 'BROWSER=none yarn start' 'wait-on localhost:3000 && electron .'
[0] ''BROWSER' is not recognized as an internal or external command,
[0] operable program or batch file.
[0] 'BROWSER=none exited with code 1
[2] 'start'' is not recognized as an internal or external command,
[2] operable program or batch file.
[2] start' exited with code 1
[3] ''wait-on' is not recognized as an internal or external command,
[3] operable program or batch file.
[3] 'wait-on exited with code 1
[4] 'http:' is not recognized as an internal or external command,
[4] operable program or batch file.
[4] localhost:3000 exited with code 1
[1/4] Resolving packages...
success Already up-to-date.
[1] yarn exited with code 0
error Command failed with exit code 1.

I'm assuming that because I'm on Windows, this tutorial won't work for me.

Collapse
 
idiranis profile image
idiranis

how can can i call express roots from react components

Collapse
 
wchr profile image
Wachira

I don't think it's possible but let me look into it

Collapse
 
wchr profile image
Wachira

Will get back to you

Collapse
 
guboongit profile image
GUBOonGIT

its weird, after follow all, the electron app pop and react is load but if i change the App.js that change nothing can I have help ?