9

I am working on an Electron application which uses React.JS for building user interfaces. Now, I have to make a preference window which is different from the main window. But, I am not sure how to tackle this because of multiple entry points' dilemma. I read that using modals could be an alternative but I wanted to do this the usual way by making different windows and communicating between them through ipc.

Any advice on the matter is appreciated!

enter image description here

Shikher Aatrey
  • 306
  • 3
  • 12

1 Answers1

10

you can do this with routes

When you open a new window, load a page like this instead of using the main app.html file.

prefsWindow.loadURL(`file://${__dirname}/app.html#/prefs`);

And then in the routes file:

you can find more information here : https://github.com/chentsulin/electron-react-boilerplate/issues/623

and example code on how routes work with react here: https://reacttraining.com/react-router/web/example/route-config

GLHF;

1-14x0r
  • 1,697
  • 1
  • 16
  • 19