skip to Main Content

so I have been making a website and I am making a registration page for people to sign up but I need to check if the email is valid or not and because of that i can’t use Link. cause I need to redirect it to a new page where i can show them the results if it was success or not and then show them some stats like how many registration do we have till now. I apologise for my mistakes and ignorance in advance

I don’t wanna add the data in the url cause that wouldn’t be clean. So if you can, can you please tell me a way to send the data between pages using Link but maybe I can do it a little more programmatically. Like after I have done all my operations and I have sent the data to my database and saved it, I can pass the email to the next page

Thank you for your help

2

Answers


  1. Chosen as BEST ANSWER

    Yeah I actually figured it out. It is too complicated I just sent back an object with my id and then just pass to the next page and then show it out.


  2. When you redirect to a new page, you use Router in NextJS. That’s the way to pass params.

    Router.push({
      pathname: '/result',
      query: { email: '[email protected]' }
    })
    

    Then in the result page

    const router = useRouter();
    
    useEffect(() => {
      console.log(router.query.email);
    }, [router.query]);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search