简体   繁体   中英

Routing in Electron + Create React App

I used create react app and electron for a project. It works fine in dev environment.

dev environment image

However when i build the project and try to run it using electron i get a blank screen. i do not see any errors. i believe this has something to do with routing since electron uses file system.

Image of my route file

How do i build the app and use react routing instead of file system ??

Import HashRouter from react router instead of BrowserRouter. BrowserRouter requires a server to function, electron does not start a webserver instead it works directly with files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM