ag-grid-react is the official React component for AG Grid, a highly performant, fully-featured, and customizable data grid library. It allows developers to integrate advanced table functionalities, such as filtering, sorting, pagination, grouping, aggregation, and extensive customization options, directly into their React applications. The package is currently at version 35.2.1 and maintains a rapid release cadence, frequently delivering new features, performance improvements, and bug fixes across minor versions, with major versions introducing significant architectural changes or API updates. A key differentiator is its focus on enterprise-grade features and performance without relying on external third-party dependencies beyond React itself, making it a robust choice for complex data visualization and manipulation tasks in React environments.
npm install ag-grid-reactVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic AG Grid React component with static data, custom column definitions including formatting, and basic grid features like filtering, sorting, and pagination. It also shows how to programmatically clear filters using the Grid API via a ref, and includes essential CSS imports.
Review the AG Grid v35 migration guide. Update export configurations to use the new `exportDataAsCsv` and `exportDataAsExcel` methods on the `GridApi`, which now accept a single object parameter for configuration instead of individual arguments. Refer to the official documentation for specific property replacements.
Consult the AG Grid v35 migration guide, specifically the section on 'Integrated Charts'. Adjust charting configurations and module imports to align with the new modular API.
Remove `cellDataType` from `columnTypes` definitions. For `autoGroupColumnDef`, use `autoGroupColumnDef.context` to store any auto-group column specific data instead of `colId`.
Always include `import 'ag-grid-community/styles/ag-grid.css';` for core styles and `import 'ag-grid-community/styles/ag-theme-your-theme.css';` (e.g., `ag-theme-alpine.css`) for a visual theme in your application's entry point or relevant component.
Ensure you are using `ag-grid-enterprise` if you require enterprise features. This typically involves importing the enterprise module (`import 'ag-grid-enterprise';`) and having a valid license key set via `LicenseManager.setLicenseKey('YOUR_LICENSE_KEY');` before the grid initializes. Otherwise, stick to community-edition features.Always guard access to `gridRef.current.api` (e.g., `gridRef.current?.api.setFilterModel(...)`) or ensure the operation is performed after the `onGridReady` callback fires, which guarantees the `api` is available.
Verify that `ag-grid-community` is installed (`npm install ag-grid-community`) and that the import paths for the CSS files are correct as per the official documentation (`import 'ag-grid-community/styles/ag-grid.css';`).
Ensure all column definitions have unique `field` properties if `colId` is not explicitly set, or assign unique `colId` values manually for more control. Review `columnDefs` updates to ensure consistency.