Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
How can I send data from one page to another as parameters in Next.JS?

This is the project structure:

  1. Pages:
    • Category1:
      • [id].tsx (let us call it page 1)
      • Category2:
        • [id].tsx (page 2)

So page 1 has been created with getStaticPaths() from a different page. What i'm trying to achieve is, clicking a button in page 1 and it redirects me to page two with 'id' as the parameter. I would later on use the 'id' recieved to make an API call to the server using getStaticProps.

Below is an onClick event for the button in page 1:

const openPage2 = (event) => {
    router.push({
      pathname: `/Category2/[_id]`,
      query: { _id: data._id }
    })
  }

But it displays a 404 page error. I would appreciate some assistance from the community here/

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!