【发布时间】:2019-10-17 23:57:03
【问题描述】:
为什么 useEffect 不能在 window.location.pathname 更改时运行?我只记录了一次loc。
当路径名更改而没有任何其他库时,我如何才能运行 useEffect?
useEffect(() => {
const loc = window.location.pathname
console.log({ loc })
}, [window.location.pathname])
【问题讨论】:
标签: reactjs