Created
August 6, 2020 07:22
-
-
Save justinbiebur/23537cc1b9fa246677bc649bfa5acc6e to your computer and use it in GitHub Desktop.
Routing without React-Router
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
const Route = ({ children, href }) => { | |
var navObj = useContext(NavigationContext); | |
var copy={...navObj}; | |
switch(copy.pathname){ | |
case href : | |
return(children); | |
default: | |
return null; | |
} | |
} | |
export default Route; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment