useLocation

Pascual Vila
Frontend Instructor.
useLocation is a Hook that allows you to access the current route's location object. You can get the current URL and other details related to the browser's location.
Example of useLocation usage:
{`import React from "react";
import { useLocation } from "react-router-dom";
function MyComponent() {
const location = useLocation();
return (
Current path: {location.pathname}
);
}
export default MyComponent;`}