Update data snippets

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-11-03 21:26:34 +02:00
parent 7875e7229d
commit 9e9e7443c2
2 changed files with 10 additions and 8 deletions

View File

@ -1,12 +1,12 @@
---
title: DataTable
tags: components,array,beginner
tags: components,beginner
---
Renders a table with rows dynamically created from an array of primitives.
- Render a `<table>` element with two columns (`ID` and `Value`).
- Use `Array.prototype.map()` 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.
- Use `Array.prototype.map()` to render every item in `data` as a `<tr>` element with an appropriate `key`.
```jsx
const DataTable = ({ data }) => {