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

244
Views
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 answers
Answer question

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 Report

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 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!