Your experience on this site will be improved by allowing cookies
React Map
A map is the standard JavaScript function, and also a type of data collection. Here, data is stored in the form of pairs. Each value stored in the map is mapped to a unique key. Thus a duplicate pair is not allowed in a map thus it offers a fast searching of data
Example:
var num = [10, 20, 30, 40, 50]; const X = num.map((number)=>{ return (number + 50); }); console.log(X); |
Explanation:
Here an array of numbers is passed to a map. A value of 50 is then added to each of the number, which is then logged.
To traverse the list elements Example:
import React from 'react'; import ReactDOM from 'react-dom'; function example(props) { const names = props.names; const nameList = names.map((name) =>
|
To traverse the list element with keys Example:
import React from 'react'; import ReactDOM from 'react-dom'; function example(props) { return
|
0 comments