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

223
Visualizações
EDIT: Main element exists. TypeError: Cannot read properties of undefined (reading 'map')

For some reason I am not rendering the element but the mapping of the articles appear. Can someone help me understand what it is I am missing?

import React from "react";
import Article from "./Article";
import { v4 as uuidv4 } from "uuid";

// ArticleList
// Make an ArticleList component as a child of App. It should return:

// a <main> element with the following components inside:
// an array of Article components (one component for each post passed down as a prop to ArticleList)
// make sure to assign a unique key prop to each Article

// {blogDataArr}
// (3) [{…}, {…}, {…}]
// 0: {id: 1, title: 'Components 101', date: 'December 15, 2020', preview: 'Setting up the building blocks of your site', minutes: 5}
// 1: {id: 2, title: 'React Data Flow', date: 'December 11, 2020', preview: 'Passing props is never passé', minutes: 15}
// 2: {id: 3, title: 'Function vs Class Components', preview: 'React, meet OOJS.', minutes: 47}
// length: 3
// [[Prototype]]: Array(0)

function ArticleList({ blogDataArr }) {
  let mapping = blogDataArr.map((row) => {
    return (
      <Article
        key={uuidv4()}
        title={row.title}
        date={row.date}
        preview={row.preview}
        />
        );
    });
    return <main>{mapping}</main>;
}

export default ArticleList;

enter image description here

:EDIT: adding the article tag for further reference!

import React from "react";


function Article({ title, date = "January 1, 1970", preview }) {
  return (
    <article>
      <h3>{title}</h3>
      <small>{date}</small>
      <p>{preview}</p>
    </article>
  );
}

export default Article;
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