Answers for "react router add path"

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
0

add react router to project

npm i react-router-dom --save
Posted by: Guest on June-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language