0

I have a Next.js application.Initially the homepage is loaded to the user and after a timer of 10 the user has to be redirected to a feedback page:

 const router=useRouter();
 if(timer==0)
  {
    router.push('/feedback');
    clearTimeout(time);
  }

However at the time of routing to feedback page , Im getting the following error:

404
This page could not be found.

Feedback page:

import type { NextPage} from 'next'
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import {useState} from 'react'
const Feedback: NextPage=()=>{
    const [name,setName]=useState("");
    const [email,setEmail]=useState("");
    const handleSubmit=(e)=>{
        e.preventDefault();
        console.log(name);
        console.log(email);

    }
    return(
        <form onSubmit={(e)=>handleSubmit(e)}>
        <div>
        <label htmlFor="name">Name</label>
        <input
          type="text"
          id="name"
          value={name}
          onChange={(e) => setName(e.target.value)}
        />
        </div>
        <div>
        <label htmlFor="email">Email</label>
        <input
          type="text"
          id="email"
          value={email}
          onChange={(e) => setEmail(e.target.value)}
        />
        </div>
      </form>
    )
}

export default Feedback;

Inspite of having a feedback page in the pages folder, Im getting this error.

juliomalves
  • 42,130
  • 20
  • 150
  • 146
Vatsal A Mehta
  • 392
  • 2
  • 15

0 Answers0