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

608
Vistas
Can't access multiple parameters of getStaticPaths from getStaticProps , Nextjs/Apollo/Graphql

Below you can check the code. I'm trying to use Id to identify single content and use titles for links,

when I console log params.title

console: android-paging-advanced-codelab

but

when I try to console log params.id,

console: undefined

I need to access both params inside the getStaticProps so I can use the exact data I need.

I did try context by passing context and using context.params.id but the result is the same.

read the code below and help me, please!

Here you can see the code of my getStaticPaths :

export async function getStaticPaths(){

  const { data } = await client.query({
    query: gql`
    query {
      postContents{
        data{
          attributes{
              post_card{
                data{
                  id
                  attributes{
                    TitleForLink
                  }
                }
              }
          }
        }
      }
    }
    `
  })
  
  const paths = data.postContents.data.map((item)=> {
    return {
      params: { 
        id: item.attributes.post_card.data.id.toString(), 
        title: item.attributes.post_card.data.attributes.TitleForLink.toString(), 
      }
    }
  })

  return {
    paths,
    fallback: false,
  }

}

And the code of getStaticProps:

export async function getStaticProps({params}){
 
  const { data } = await client.query({
    query: gql`
    query {
      postCards{
        data{
          id
          attributes{
            post_content{
              data{
                id
                attributes{
                  Title
                  Description
                }
              }
            }
          }
        }
      }
    }
    `
  })
  console.log(params.id)
  return {
    props: {
      content: data.postCards.data,
    }
  }
}
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