我尝试使用Component={Link} to={path},但这只会改变URL。 内容显示在 main 内部,我在那里使用了路由,如下所示:
<main>
<Switch>
<Route path={..} component={..}>
.
.
.
</Switch>
</main
但这行不通,内容不会改变
链接到材料 UI 示例:https://codesandbox.io/s/v66pl
根据您的要求添加到您的示例中:BrowserRouter
、Link
。
https://codesandbox.io/s/material-demo-605w9