Created
August 22, 2022 18:37
-
-
Save NicholasTurner23/5ca800683c69d26d62961d205b9bd64d to your computer and use it in GitHub Desktop.
UseLocation to route
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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