I'm trying to do something like accordion in ReactJs.
Now I have 3 components: <TableList>,<TableListGroupRow>,<TableListRow>
In List render method I push GroupRows and Rows to an array, which is rendered then.
//one group row for example
var group;
tableRows.push(
group =
<TableListGroupRow
onClick={this.toggleOpenGrp } />
);
//one row for example
var row;
tableRows.push(
row =
<TableListRow
onClick={this.rowClick2 } />
);
group.children.push(row);
return (
<tbody>
{tableRows}
</tbody>
);
I'm trying to store links to rows into groupRow.children they belong to. By the idea I could listen to a click on a groupRow and set state to hidden for all Rows in its 'children' property.
But as I learned <TableListGroupRow> doesn't return an instance object with children array in it. Maybe it's totally incorrect concept. Please, let me know how such thing's made in react.
Thanks!