How to use React Router with Electron?

后端 未结 7 930
生来不讨喜
生来不讨喜 2020-12-14 00:08

Using this boilerplate as reference I created an Electron app. It uses webpack to bundle the scripts and express server to host it.

Webpack config is practically sam

7条回答
  •  春和景丽
    2020-12-14 00:28

    I'm using React Router v4 and didn't want to fallback to the HashRouter, so I solved it with something amongst the likes of:

    import { Redirect, BrowserRouter } from 'react-router-dom';
    
    const App = () => (
      
        
    {window.location.pathname.includes('index.html') && }
    );

提交回复
热议问题