Update all snippets to new format

This commit is contained in:
Angelos Chalaris
2019-08-21 12:28:50 +03:00
parent 3deff54251
commit 7dfaffe7ac
26 changed files with 108 additions and 132 deletions

View File

@ -1,4 +1,7 @@
### MappedTable
---
title: MappedTable
tags: array,object,intermediate
---
Renders a table with rows dynamically created from an array of objects and a list of property names.
@ -7,6 +10,8 @@ Renders a table with rows dynamically created from an array of objects and a lis
* Use `Array.prototype.map` to render each value in the `propertyNames` array as a `<th>` element.
* Use `Array.prototype.map` to render each object in the `filteredData` array as a `<tr>` element, containing a `<td>` for each key in the object.
*This component does not work with nested objects and will break if there are nested objects inside any of the properties specified in `propertyNames`*
```jsx
function MappedTable({ data, propertyNames }) {
let filteredData = data.map(v =>
@ -48,11 +53,3 @@ ReactDOM.render(
document.getElementById('root')
);
```
#### Notes:
- This component does not work with nested objects and will break if there are nested objects inside any of the properties specified in `propertyNames`.
<!-- tags: array,object -->
<!-- expertise: 1 -->