Created
October 23, 2019 09:28
-
-
Save react-ram/1f3425c09a262e722c7925fcaf07640d to your computer and use it in GitHub Desktop.
Basics - Lists & keys example 5. Using map( ) in JSX.
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
import React, { Component } from "react"; | |
class App extends Component { | |
render() { | |
const numbers = [1, 2, 3, 4, 5]; | |
return ( | |
<ul> | |
{numbers.map(number => ( | |
<li key={number.toString()}>{number}</li> | |
))} | |
</ul> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment