Skip to content

Instantly share code, notes, and snippets.

@dev-cyprium
Last active February 22, 2021 21:58
Show Gist options
  • Select an option

  • Save dev-cyprium/44312eb74be7f8d5ac026879866613b3 to your computer and use it in GitHub Desktop.

Select an option

Save dev-cyprium/44312eb74be7f8d5ac026879866613b3 to your computer and use it in GitHub Desktop.
import { useRouter } from './router';
function Navigation() {
const router = useRouter();
const changeRoute = (route) => () => {
router.push(route);
}
return (
{/* Rest of the markup... */}
<button
onClick={changeRoute("/test")}
className="transition block bg-gray-800 py-2 px-2 w-full text-left"
>Page
</button>
{/* Rest of the markup... */}
):
}
export default function App() {
return (<AppRouter>
<div className="flex w-screen h-screen">
<div className="bg-gray-800 w-1/5">
<Navigation />
...);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment