-
-
Save robdecker/3e3567e81fb3accd7f832a0b6684937d to your computer and use it in GitHub Desktop.
[Javascript map] #js
This file contains 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
const items = [ | |
{ | |
title: 'Item 1' | |
}, | |
{ | |
title: 'Item 2' | |
}, | |
{ | |
title: 'Item 3' | |
}, | |
] | |
// Plain javascript | |
items.map(item => { | |
console.log(item.title); | |
}); | |
// React JSX | |
{items.map((item, index) => { | |
<p key={index}>{item.title}</p> | |
})} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment