Skip to content

Instantly share code, notes, and snippets.

@akopcz2
Last active October 16, 2019 21:02
Show Gist options
  • Save akopcz2/acace37209c17b67a843f356a7995fdb to your computer and use it in GitHub Desktop.
Save akopcz2/acace37209c17b67a843f356a7995fdb to your computer and use it in GitHub Desktop.
looping tables
<Fragment>
{data.tables.map((table, i) => {
return <section key={i} className="ourTable">
<table>
<caption>{table.title}</caption>
<tbody>
{table.rows.map((row, i) => {
return <tr className={`col-${i + 1}`} key={i}>
{row.cols.map((col, i) => {
return <td className={`col-${i + 1}`} key={i}>{col.value}</td>
})}
</tr>
})}
</tbody>
</table>
</section>
})}
</Fragment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment