Renders a table with rows dynamically created from an array of primitives.

  • Render a <table> element with two columns (ID and Value).
  • Use to render every item in data as a <tr> element, consisting of its index and value, give it a key produced from the concatenation of the two.


function DataTable({ data }) {
  return (
        {, i) => (
          <tr key={`${i}_${val}`}>


const people = ['John', 'Jesse'];
ReactDOM.render(<DataTable data={people} />, document.getElementById('root'));