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

611
Views
No se puede acceder a múltiples parámetros de getStaticPaths desde getStaticProps , Nextjs/Apollo/Graphql

A continuación puedes consultar el código. Estoy tratando de usar Id para identificar contenido único y usar títulos para enlaces,

cuando consuelo log params.title

consola: android-paginación-avanzado-codelab

pero

cuando intento consolar log params.id,

consola: indefinido

Necesito acceder a ambos parámetros dentro de getStaticProps para poder usar los datos exactos que necesito.

Probé context pasando context y usando context.params.id pero el resultado es el mismo.

¡Lee el código de abajo y ayúdame, por favor!

Aquí puedes ver el código de mis 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, } }

Y el código de 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
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!