--- title: Data table tags: components cover: armchair firstSeen: 2018-11-29T11:13:59+02:00 lastUpdated: 2020-11-03T21:26:34+02:00 --- Renders a table with rows dynamically created from an array of primitives. - Render a `` element with two columns (`ID` and `Value`). - Use `Array.prototype.map()` to render every item in `data` as a `` element with an appropriate `key`. ```jsx const DataTable = ({ data }) => { return (
{data.map((val, i) => ( ))}
ID Value
{i} {val}
); }; ``` ```jsx const people = ['John', 'Jesse']; ReactDOM.render(, document.getElementById('root')); ```