Skip to content

Instantly share code, notes, and snippets.

@nijjwal
Last active October 9, 2022 09:36
Show Gist options
  • Save nijjwal/9b4e09659f5ffe7b7b16ff6d523dae9c to your computer and use it in GitHub Desktop.
Save nijjwal/9b4e09659f5ffe7b7b16ff6d523dae9c to your computer and use it in GitHub Desktop.
react map
import React, { useState } from 'react'
export default function Signup() {
const people = [{name:'Jamie', age:37, id:1},{name:'Tyrion', age:36, id:2}];
const [users, updateUser] = useState(people);
//For Printing in cosole
people.map((person)=>{
console.log(person.name)
})
//For Displaying on screen
return (
people.map(
person=>{
return <div key={person.id}>{person.name}</div>
}
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment