Last active
February 22, 2021 21:58
-
-
Save dev-cyprium/44312eb74be7f8d5ac026879866613b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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