I have simple component that represents instances of other component as html table.
class Table extends Component {
render() {
const { data } = this.props;
const articles= data.map((el, i) =>
<tr><td><Post post={el}/></td></tr>);
return <table>
{articles}
</table>;
}
Now I have only one table cell per row. I want to place three cells per row, for example.
I tried something like this
const articles = data.map(function(el, i) {
i++;
if (i == 1)
return <tr><td><Post post={el}/></td>;
else if (i % 3 == 0)
return <td><Post post={el}/></td></tr>;
else if (i % 4 == 0)
return <tr><td><Post post={el}/></td>;
else
return <td><Post post={el}/></td>;
});
This is a bad way, anyway. But in JSX this is impossible, because I get error "unterminated JSX contents".
ReactTable is not suitable for me, because I have table of another components, not data grid.