I have tried to create a table with raw expanded as default i have tried expandedRows and defaultExpanded but none of them worked (no console error)
Codepen (https://codepen.io/anon/pen/eReewL?editors=0010)
columns={columns}
defaultExpanded={ {0: true, 2: true} }
expandedRows={ {0: true, 2: true} }
SubComponent={ ()=>
It does appear that defaultExpanded is not working correctly.
But if you're willing to completely take over the expanded rows, if you change expandedRows to expanded it does work. The API changed in 6.0.0 but I do see a reference in the readme still to the old expandedRows api.
I just tried the same and it works with 'expanded' instead of 'expandedRows'.
Indeed, this looks broken.
Hi,It seems that the defaultExpanded is still not working ,but I have updated my version to 6.5.1
It still seems it's not working.
I am facing the same issue. I need a few lines to be expanded by default. when I use defaultExpanded , it's not working at all and when I use 'expanded' property, the rows will be expanded but they won't be collapsed anymore as the user clicks on the row.
What appears to be happening is that the rows start by respecting defaultExpanded, but immediately close on initial render.

This is still happening to me.
using defaultExpanded and pivotBy
expanded does work, but the row cannot be collapsed
To anyone currently experiencing this issue, a workaround I've come up with is to just use expanded with onExpandedChange and just implement the expected behaviour like so:
getExpanded() {
return this.state.expanded;
}
setExpanded(e) {
this.setState({
expanded: e,
});
}
<ReactTable
expanded={this.getExpanded()}
onExpandedChange={e => {
this.setExpanded(e);
}}
/>
and then in your constructor set a default expanded object:
this.state = {
expanded: { 0: true },
};
Most helpful comment
To anyone currently experiencing this issue, a workaround I've come up with is to just use
expandedwithonExpandedChangeand just implement the expected behaviour like so:and then in your constructor set a default expanded object: