import * as React from 'react' ; import { useLocation } from 'react-use' ; export function useOnLocationChange ( callback , extraDeps = [ ] ) { const { href , pathname , search } = useLocation ( ) ; React . useEffect ( callback , [ href , pathname , search , callback , ... extraDeps ] ) ; }