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

181
Views
Reactjs (Nextjs): no se pueden leer las propiedades de undefined (leyendo 'mapa') Reactjs (Nextjs)

Quiero preguntar sobre este error, necesito su ayuda, porque estoy viendo un curso de youtube y solo yo recibo este error y no sé por qué.

 import Head from 'next/head'; import styles from '../styles/Home.module.css'; import { GraphQLClient, gql } from 'graphql-request'; import BlogCard from '../components/BlogCard'; const graphcms = new GraphQLClient("https://api-eu-central-1.graphcms.com/v2/cl3wfrf6agpo701z13eawdfat/master"); const QUERY = gql` { posts{ id, title, datePublished, slug, content{ html } author{ name, avatar{ url } } coverPhoto{ url } } } `; export async function getStaticProp() { const { posts } = await graphcms.request(QUERY); return { props: { posts, }, revalidate: 10, }; } export default function Home({ posts }) { return ( < div className = { styles.container } > < Head > < title > Create Next App < /title> < meta name = "description" content = "Generated by create next app" / > < link rel = "icon" href = "/favicon.ico" / > < /Head> < main className = { styles.main } > { posts.map((post) => ( < BlogCard title = { post.title } author = { post.author } coverPhoto = { post.coverPhoto } key = { post.id } datePublished = { post.datePublished } slug = { post.slug } > < /BlogCard> )) } < /main> < / div > ) }

me sale este error y no se porque

Aquí hay una captura de pantalla del error:

Aquí hay una captura de pantalla del error.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La variable de publicaciones probablemente esté vacía, es posible que desee agregar una verificación antes de iterar como se muestra a continuación.

 <main className={styles.main} > {posts && Array.isArray(posts) && posts.map((post) => ( <BlogCard title={post.title} author={post.author} coverPhoto={post.coverPhoto} key={post.id} datePublished={post.datePublished} slug={post.slug} ></BlogCard> )) } </main>

about 4 years ago · Juan Pablo Isaza Report
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!