Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda