[英]Routing in Electron + Create React App
I used create react app and electron for a project. 我曾为一个项目使用create react app和electronic。 It works fine in dev environment.
它在开发环境中运行良好。
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导入HashRouter。 BrowserRouter requires a server to function, electron does not start a webserver instead it works directly with files.
BrowserRouter需要服务器才能运行,electron不会启动Web服务器,而是直接与文件一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.