React ES6 Array Methods
Array Methods
There are many JavaScript array methods.
One of the most useful in React is the .map()
array method.
The .map()
method allows you to run a function on each item in the array,
returning a new array as the result.
In React, map()
can be used to generate lists.
ExampleGet your own React.js Server
Generate a list of items from an array:
const myArray = ['apple', 'banana', 'orange'];
const myList = myArray.map((item) => <p>{item}</p>)
Exercise?What is this?
Test your skills by answering a few questions about the topics of this page
What is a correct statement of the array map()
method?