I tried setting rowGrouping to a specific column as shown below:
columnDefs[index]["rowGroup"] = true;
this.setState({ columnDefs: columnDefs });
params.api.setColumnDefs(columnDefs);
The grid is getting rerendered but the row grouping is not getting set. Is there any other ag-grid api to set the row groups manually(just like columnApi.setColumnVisible to hide/show a specific column).