2. useLocation Hook. In React, routers help create and navigate between the different URLs that make up your web application. React router has a hook which can be very useful to know the current route. Other types of routers have different purposes, but the docs recommend BrowserRouter for web apps.. And now, inside this BrowserRouter component, other components and hooks from react-router-dom can work.. In single-file components, make sure you set the