Closed maheshj01 closed 6 months ago
const handleLogin = (event: React.FormEvent) => { event.preventDefault(); // Handle login logic here console.log("Logging in with email:", email, "and password:", password); router.push("/dashboard"); };
When you clicked "Login," the form tried to submit to the server by default. To run your custom login logic instead, you need to prevent the default form submission with event.preventDefault(). This allows your login logic to execute, like navigating to the /dashboard page
Link to the code that reproduces this issue
https://github.com/maheshmnj/my-app
To Reproduce
npm run dev
Both the steps 3, 4 use
I also tried routing using window api it doesn't work either
project creation logs
Let me know if you need any further info
Current vs. Expected behavior
Actual Result: Routing fails no error in console and page refreshes
Expected Result: Routing should work or atleast show some error in console
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response