DEV Community

Cover image for Mapping Components to Data in React JS
Dhairya Shah
Dhairya Shah

Posted on

Mapping Components to Data in React JS

In this article, I will be showing you how to map components in React JS

Purpose of mapping components to data:

Instead of writing every single component again and again for every single data, we can map components to the data easily by creating an array and map them with map() function and will fetch every single data in an array to a single component

For example:

let arr = [1,2,3,4,5]
const sum = arr.map((e)=>{
   return (e+1);
 });
Enter fullscreen mode Exit fullscreen mode

It will add the number to the 1 to every single number inside array arr. This same logic applies in React component mapping, and for that I have made a video on that so make sure to check that 👇


So, this was it; I hope that this article/video might be helpful to you

Top comments (4)

Collapse
 
bmunyiri profile image
bmunyiri

Thank You, The video has really help me...

Collapse
 
dhairyashah profile image
Dhairya Shah

You're welcome 🙂 Thanks for watching!

Have a great day!

Collapse
 
serdarplg profile image
Serdar

thanks for the tutorial!

Collapse
 
dhairyashah profile image
Dhairya Shah

You're welcome Serdar