class App extends Component {
render() {
return (
<Provider {...store}>
<HashRouter basename="/">
<Layout/>
</HashRouter>
</Provider>
);
}
}
Code inside Layout
<Layout.Content className="content">
<Routes />
</Layout.Content>
Routes Code
import React from "react";
import loadable from "react-loadable";
import { Switch, Route } from "react-router-dom";
import Home from "./page/home.jsx";
const AsyncGroup = loadable({
loader: () => import(
/* webpackChunkName: "group" */
"./page/group.jsx"
),
loading: Loading,
});
function Loading() {
return <div>Loading.....</div>;
}
const Routes = () => (
<Switch>
<Route exact path="/" component={Home} />
<Route path="/group" component={AsyncGroup} />
{/* <Redirect from="*" to="/404" /> */}
</Switch>
);
export default Routes;
you can switch routes normally using Link, but the operations mentioned above cannot be switched.
I would like to ask whether router.history is the history, in Router
Why can Link change both at the same time, but the above operation is not?