不添加 history 時,來回點擊 Link 會在控制台報錯如下
Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack
解決方案是安裝使用 history 模塊
import createBrowserHistory from "history/createBrowserHistory";
const customHistory = createBrowserHistory();
<Router history = {customHistory} />