My electron app works fine with HashHistory, but when I switch to browserHistory,not working fine.
I noticed that the two have different initial pathname.
const history = createHashHistory();
console.log(history.location.pathname);
// "/"
const history = createBrowserHistory();
console.log(history.location.pathname);
// "/C:/Users/asdf/Documents/GitHub/electron-react-boilerplate/app/app.html"
// This path matches the route "/C:/"
// and when I use "history.goBack()" and "history.goForward()" also found some errors
then i use the following code, the problem is solved.
const history = createBrowserHistory({
basename: window.location.pathname
});
Just ran into this same issue. Thanks for providing the solution!
Most helpful comment
then i use the following code, the problem is solved.