html - Return multiple elements from React Component -
i have component renders table appropriate styling. is, @ moment, single monolithic component takes huge chunk of data defining columns , data rows.
<mytable columns={mycolumnlist} data={mytabledata} />
one of key features of table render 2 rows if there additional data not defined in list of columns. selecting row reveal additional data not displayed in table.
i break component smaller elements can use bits need or use alternatives. like:
<mytable> <mytableheader columns={mycolumnlist} /> <mytablebody> <mytablerow data={row1data} /> <mytablerow data={row2data} /> <mytablerow data={row3data} /> </mytablebody> <mytablefooter /> </mytable>
but, produce 2 rows. need component potentially have render 2 elements.
the normal way return multiple elements component wrap in invalid html within table.
is there way can have react component renders multiple elements without wrapping them single ?
or, there simpler solution have missed.
a <table>
can have multiple <tbody>
children, 1 option "row" component return like:
<tbody> <trow></trow> <trow></trow> </tbody>
if did this, should remove "body" component wrapping rows.
Comments
Post a Comment