Answers for "get current url path react-router"

3

react get current route

/*In the 5.1 release of react-router there is a hook called useLocation,
which returns the current location object. 
This might be useful any time you need to know the current URL.*/
import { useLocation } from 'react-router-dom';

const location = useLocation();
console.log(location.pathname);
Posted by: Guest on December-24-2020
2

get url react

window.location.href
Posted by: Guest on April-15-2020

Code answers related to "get current url path react-router"

Code answers related to "Javascript"

Browse Popular Code Answers by Language