📜  chrome 后退按钮单击事件反应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:02.101000             🧑  作者: Mango

代码示例2
const {history} = useRouter();
  useEffect(() => {
    return () => {
      // && history.location.pathname === "any specific path")
      if (history.action === "POP") {
        history.replace(history.location.pathname, /* the new state */);
      }
    };
  }, [history])