我有这个应用程序:
function App() {
const reload = () => {
console.log()
}
return (
<div className="App">
<Router>
<div>
<Link to="/table/metadata/" onClick={reload}>
<button class="button" >
<span>
Metadata
</span>
</button>
</Link>
<Link to="/table/spot/">
<button class="button">
<span>
SPOT
</span>
</button>
</Link>
<Link to="/table/activity/">
<button class="button">
<span>
Activity
</span>
</button>
</Link>
<Link to="/table/users/">
<button class="button">
<span>
Users
</span>
</button>
</Link>
</div>
<Routes>
<Route path="/table/:name/" element={<SortingTable/>}></Route>
<Route path="" exact element={<BasicTable/>}></Route>
</Routes>
</Router>
</div>
);
}
如果我从localhost
转到localhost/table/any_table
,页面会显示正确的表,但如果我尝试从任何表转到另一个表,例如从localhost/table/activity
转到localhost/table/metadata
,则页面会显示活动表,而url会更改为localhost/table/metadata
1条答案
按热度按时间zf9nrax11#
变更:
收件人: