For anyone looking for more info about that :
//in component constructor, add state declaration :
this.state = {
expanded: {}
}
//in component render function - set "expanded" to component state:
expanded={this.state.expanded}
// still in component render() - set an event callback - I prefer to use a dedicated event manager here named handleRowExpanded :
onExpandedChange={(newExpanded, index, event) => this.handleRowExpanded(newExpanded, index, event)}
// then declare an event manager :
handleRowExpanded(newExpanded, index, event) {
this.setState({
// we override newExpanded, keeping only current selected row expanded
expanded: {[index]: true}
});
}
HTH :)