Skip to content

Instantly share code, notes, and snippets.

@codewithbernard
Created December 6, 2021 09:35
Show Gist options
  • Select an option

  • Save codewithbernard/5f3f014a5e048d7b2187ea3a1fbfaa65 to your computer and use it in GitHub Desktop.

Select an option

Save codewithbernard/5f3f014a5e048d7b2187ea3a1fbfaa65 to your computer and use it in GitHub Desktop.
const users = [
{ name: "John", age: 24 },
{ name: "Linda", age: 19 },
{ name: "Josh", age: 33 }
];
function App() {
const renderUsers = () => {
const result = [];
for (const user of users) {
result.push(<li>{user.name}</li>);
}
return <ul>{result}</ul>;
};
return <div className="App">{renderUsers()}</div>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment