Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save codewithbernard/c6f3985acccc7860d0e38d0443f85fd8 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 (let i = 0; i < users.length; i++) {
result.push(<li>{users[i].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