Skip to content

Instantly share code, notes, and snippets.

@VithuJey
Last active October 22, 2021 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VithuJey/71ba9cd292030193f00a00d612f720a3 to your computer and use it in GitHub Desktop.
Save VithuJey/71ba9cd292030193f00a00d612f720a3 to your computer and use it in GitHub Desktop.
Just a gist to explain React Router
<Route path="/search" children={<Search />} />
...
<Link to={`/search?category=${cat}&bundle=${bund}`}>Search</Link>
...
let location = useLocation();
console.log(location)
/*
{
pathname: '/search',
search: '?category=grocery&bundle=b156',
hash: '',
state: undefined
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment