Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

273
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda