Answers for "where do i set the 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
39

Install react router in react app

npm install react-router-dom
Posted by: Guest on February-03-2020

Code answers related to "where do i set the react router ?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language