import React from 'react'; const people = [ { name: 'James', age: 31, }, { name: 'John', age: 45, }, { name: 'Paul', age: 65, }, { name: 'Ringo', age: 49, }, { name: 'George', age: 34, } ]; function App() { return ( <div> {people.filter(person => person.age < 60).map(filteredPerson => ( <li> {filteredPerson.name} </li> ))} </div> ); } export default App;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter