📜  useLocation - Javascript 代码示例

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

代码示例2
// React Router v6: hook returns current location object
import { useLocation } from 'react-router-dom'

function App() {
  let location = useLocation()
  
  useEffect(() => {
    ga('send', 'pageview')
  }, [location])
  
  return (/*...*/)
}