Answers for "browserrouter current path"

1

browserrouter current 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