import React from "react"; import ReactDOM from "react-dom"; class App extends React.Component { render() { return [ { name: "Sam", email: "somewhere@gmail.com", public: false }, { name: "Ash", email: "something@gmail.com", public: true } ].map((anObjectMapped, index) => { return anObjectMapped.public ? ( <p key={`${anObjectMapped.name}_{anObjectMapped.email}`}> {anObjectMapped.name} - {anObjectMapped.email} </p> ) : null; }); } } ReactDOM.render(<App />, document.getElementById("container"));
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