Запустите Redux Hooks внутри OnGridReady AgGridReact - PullRequest
0 голосов
/ 09 июля 2020
• 1000 ошибка
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app

У меня есть AgGrid внутри a и он связан с контейнером.

...
const onGridReady = (params) => {
        params.api.sizeColumnsToFit();
            this.gridApi = params.columnApi;

            const datasource = {
                getRows: (params) => {
                    var rowsThisPage = functionFetcher();  // This is the function
                    params.successCallback(rowsThisPage, -1);
                }
            }
            params.api.setDatasource(datasource);
    }

    return (
        <div className="ag-theme-balham" style={styleGrid}>
            <AgGridReact
                gridOptions={gridOptions}
                onGridReady={onGridReady}>
            </AgGridReact>
        </div>
    );
...