Skip to content

Instantly share code, notes, and snippets.

@NicholasTurner23
Created August 22, 2022 18:37
Show Gist options
  • Save NicholasTurner23/5ca800683c69d26d62961d205b9bd64d to your computer and use it in GitHub Desktop.
Save NicholasTurner23/5ca800683c69d26d62961d205b9bd64d to your computer and use it in GitHub Desktop.
UseLocation to route
function CategoryPage() {
let location = useLocation();
return (
<div>
<h2>Categories</h2>
<ul>
<li><Link to={`${location.pathname}/drama`}>Drama</Link></li>
<li><Link to={`${location.pathname}/comedy`}>Comedy</Link></li>
</ul>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment