Last active
October 9, 2022 09:36
-
-
Save nijjwal/9b4e09659f5ffe7b7b16ff6d523dae9c to your computer and use it in GitHub Desktop.
react map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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