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

247
Visualizações
TypeError: .map is not a function don't understand what's wrong

I don't understand why this component doesn't work Here is link to img "because somehow i can't post image directly [1]: https://i.stack.imgur.com/Ax7im.png Thank's for any help Here you have code:

import React from 'react';
import ReactDOM from 'react-dom';
import Postitem from "./Postitem";

const Postlist=(post,title)=>{

return (
<div>
         <h1 style={{textAlign: 'center'}}>{title}</h1>
{post.map((post) =>
 <Postitem post={post} key={post.id}/>)};
</div>
 
)};
export default Postlist;
      
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

React function components only ever take one argument, which is an object containing all the props. Assuming you are passing a post prop as an array when you are rendering it, fixing your function declaration to this will work:

const Postlist=({post,title})=>{
  // component body here, as above
}
about 4 years ago · Juan Pablo Isaza Relatório

0

Check, what is coming in the "post" variable to this component. If you use "post.map" function, then it must be an array.

about 4 years ago · Juan Pablo Isaza Relatório
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