Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use location hook

import * as React from 'react';
import { useLocation } from 'react-router-dom';

function App() {
  let location = useLocation();

  React.useEffect(() => {
    ga('send', 'pageview');
  }, [location]);

  return (
    // ...
  );
}
Source by reactrouter.com #
 
PREVIOUS NEXT
Tagged: #location #hook
ADD COMMENT
Topic
Name
7+1 =