react map example

Example 1: react map

{array.map((item)=>{
  return (
    <div key={item.id}>I am one Object in the Array {item}</div>
  )
})}

Example 2: map function in react

function NameList() {
	const names = ['Bruce', 'Clark', 'Diana']
    return (
    	<div>
      {names.map(name => <h2>{name}</h2>)}
      	</div>
    )
}

Example 3: how map work in react

{this.state.data.map((person) => <TableRow key = {shortid.generate()} data = {person} />)}

Example 4: react map example leaflets

<style>.leaflet-container {    height: 400px;    width: 800px;}</style>