Fill in the blanks to create a valid component that iterates through the received props array and returns <p> elements for each | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 5

Fill in the blanks to create a valid component that iterates through the received props array and returns <p> elements for each

21st Dec 2020, 1:17 PM
Pawan Kumar Bamne
Pawan Kumar Bamne - avatar
3 Answers
+ 1
Here is the solution: function MyList(props) { const arr = props .data; const listItems = arr. map ((val) => < p >{val}</p> ); return <div>{listItems}</div>; }
10th Aug 2021, 5:25 PM
Owethu Sotomela
Owethu Sotomela - avatar
0
props map p return
22nd Sep 2022, 8:50 AM
LIPSA BEHERA
- 1
is the JS? or HTML?
23rd Dec 2020, 9:48 PM
GeoneveStudios
GeoneveStudios - avatar