Skip to content

Instantly share code, notes, and snippets.

@imjakechapman
Created August 15, 2019 21:20
Show Gist options
  • Select an option

  • Save imjakechapman/6b56df4ad66c3c66862f34198f70c787 to your computer and use it in GitHub Desktop.

Select an option

Save imjakechapman/6b56df4ad66c3c66862f34198f70c787 to your computer and use it in GitHub Desktop.
Location State
const Example = () => (
<Router>
<h1>Location State Example</h1>
<Route>
{({ location }) => {
<Switch>
<Location state={null} component={Page1} />
<Location state="page2" component={Page2} />
<Location state="page3" component={Page3} />
<Location component={NotFound} />
</Switch>
}}
</Route>
</Router>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment