Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useLocation

// 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 (/*...*/)
}
Source by reactrouter.com #
 
PREVIOUS NEXT
Tagged: #useLocation
ADD COMMENT
Topic
Name
6+1 =