Answers for "react map array to jsx"

1

react array.map with return

const robots = ['Bruce', 'Clark', 'Diana']
 .
 .
 .
 
robots.map((robot, index) => {
                    return (
                        <h1 key={index}>{robot} </h1>
                    )
})
Posted by: Guest on June-02-2022
0

map an array in react

//lets say we have an array of objects called data
<div className="sample">
  {data.map((item)=>{
    return(
  <div key={item.id} className="objectname">
    <p>{item.property1}</p>
    <p>{item.property2}</p>
  </div>
    );
  });
</div>
Posted by: Guest on December-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language