Answers for "get path name from react router"

3

react get route path

import { useLocation } from 'react-router-dom'

function HeaderView() {
  const location = useLocation();
  console.log(location.pathname);
  return <span>Path : {location.pathname}</span>
}
Posted by: Guest on May-09-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language