I'm trying to use the Router provided by react but something doesn't work and I don't know what... First I used the BrowserRouter and I had an url like: home/login. However the Redirect didn't work in the build but only in the development enviromnent. After that I changed BrowserRouter to HashRouter and, even if the Redirect works in the build, I have an url like that: home/login#/home/login. What is wrong?
const App = () => {
return (
<HashRouter basename={pack.homepage}>
<MuiThemeProvider theme={theme}>
<UserProvider>
<Router />
</UserProvider>
</MuiThemeProvider>
</HashRouter>
);
};
In the Router component:
<Aux>
<Switch>
<Route path="/login" exact component={Login} />
{isAuthenticated ? <Route path="/" strict component={Main}/> : null}
<Redirect to="/login"/>
</Switch>
</Aux>