I'm trying to build an App using nextjs 13 and the new App router feature (https://nextjs.org/blog/next-13-4) :
My problem is about navigation, I'm following the documentation but nothing happened
First of all, here's a minimal component :
"use client"
import { useRouter } from "next/navigation";
export default function Header() {
const router = useRouter();
return (
<div>
...
<Modal
onClose={() => {
console.log("Hello")
router.push("/number")
}}
>
...
</Modal>
</div>
)
}
When the modal get closed, in the console, I can find the "Hello" text, but I'm not getting routed
According to the documentation : https://nextjs.org/docs/app/api-reference/functions/use-router
router.push
should work :/
Here's a codesandbox to see it in live : https://codesandbox.io/p/sandbox/fervent-minsky-fklfmj?file=%2Fstyles%2FLoginForm.module.css%3A19%2C1