ReactJS – How To Use MAP() Function

In the article we will tell you about map() method that is largely used in react js to map react array and show new array output from the old array. In our course, we will take later more on it but first, you may need to know about the array map() function to st small idea about this method.

Let’s understand this method with the below example. Where we are looking to double the value of the current array for each value.

The example has three values 3, 5, 8, we need to double the values 6, 10, 16 in the output so, we use fast and effective below array method as the example structure.

Array Map() Example

const number = [3, 5, 8];
const newarraymap =  number.map((nm)=>{
   return nm * 2;
});
 
console.log(number);
console.log(newarraymap);

Hope the example gives you an idea about how to use reactjs array map function in javascript and we will guide you for a complete react tutorial, please connect with us to get more reactjs articles.

Stay in touch. Ask Questions.
Lean on us for help, strategies and expertise.

Leave a Reply

Your email address will not be published. Required fields are marked *