How does one get the current route for reach router. In react router one would get that through the params?
The docs don't currently show an example how to do this.
How does one get the current route for reach router. In react router one would get that through the params?
The docs don't currently show an example how to do this.
You can simply just import useLocation
from @reach/router
and assign it to a const use it in your code as below.
import React from "react";
import { useLocation } from "@reach/router";
const YourPage = () => {
const location = useLocation();
return (
<Page>
<div>{(location.pathname = "/terms/")}</div>
</Page>
);
};
export default YourPage;