Skip to content

Instantly share code, notes, and snippets.

@shameemreza
Created March 31, 2023 17:19
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 shameemreza/66cb8e99efa4de559ea52a488b4f2fbe to your computer and use it in GitHub Desktop.
Save shameemreza/66cb8e99efa4de559ea52a488b4f2fbe to your computer and use it in GitHub Desktop.
Code for the "How to Render an Array of Objects in React?" Article.
import React from "react";
function EmployeeList(props) {
const employees = props.employees;
const employeeList = employees.map((employee) => (
<div key={employee.id}>
<h2>{employee.name}</h2>
<p>Age: {employee.age}</p>
<p>Position: {employee.position}</p>
</div>
));
return <div>{employeeList}</div>;
}
export default EmployeeList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment