Skip to content

Instantly share code, notes, and snippets.

@react-ram
Created October 23, 2019 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save react-ram/1f3425c09a262e722c7925fcaf07640d to your computer and use it in GitHub Desktop.
Save react-ram/1f3425c09a262e722c7925fcaf07640d to your computer and use it in GitHub Desktop.
Basics - Lists & keys example 5. Using map( ) in JSX.
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