Getting Started with React Data Grid
23 Jul 202611 minutes to read
This section explains the steps required to create a simple React Data Grid component and demonstrate its basic usage in a React environment.
Ready to streamline your Syncfusion® React development? Discover the full potential of Syncfusion® React components with Syncfusion® AI Coding Assistant. Effortlessly integrate, configure, and enhance your projects with intelligent, context-aware code suggestions, streamlined setups, and real-time insights—all seamlessly integrated into your preferred AI-powered IDEs like VS Code, Cursor, Syncfusion® CodeStudio and more. Explore Syncfusion® AI Coding Assistant.
To get started quickly with React Data Grid, you can watch this video:
Prerequisites
| Requirement | Version |
|---|---|
| React | 15.5.4 or higher |
| Node.js | 14.0.0 or above |
| Yarn (optional) | 0.25 or above |
React supported versions
| React version | Minimum Syncfusion React Data Grid version |
|---|---|
| React v19 | 29.1.33 and above |
| React v18 | 20.2.36 and above |
| React v17 | 18.3.50 and above |
| React v16 | 16.2.45 and above |
Browser support
| Browser | Supported versions |
|---|---|
| Chrome | Latest |
| Firefox | Latest |
| Opera | Latest |
| Edge | 13+ |
| Internet Explorer (IE) | 11+ |
| Safari | 9+ |
| iOS Safari | 9+ |
| Android Browser / Chrome for Android | 4.4+ |
| Windows Mobile | IE 11+ |
Setup for local development
Easily set up a React application using create-vite-app, which provides a faster development environment, smaller bundle sizes, and optimized builds compared to traditional tools like create-react-app. For detailed steps, refer to the Vite installation instructions. Vite sets up your environment using JavaScript and optimizes your application for production.
Note: To create a React application using
create-react-app, refer to this documentation for more details.
To create a new React application, run one of the following commands based on your preferred language:
React with JavaScript
npx create-vite@latest my-app --template react
React with TypeScript
npx create-vite@latest my-app --template react-ts
During the setup process, the CLI will prompt you for a few configuration options. Select the following:
- Which linter to use? → ESLint
- Install with npm and start now? → Yes
Selecting Yes automatically installs the project dependencies and starts the development server.
After verifying that the application starts successfully, terminate the development server in the terminal and proceed to the next step.
Then, navigate to the project directory:
cd my-app
Adding React Grid packages
To install the Grids package, use the following command:
npm install @syncfusion/ej2-react-grids --save
Adding CSS reference
Themes for Syncfusion® Data Grid component can be applied using CSS files provided through npm theme packages. For available themes, refer to the Themes documentation.
Install the Material 3 theme package using the following command:
npm install @syncfusion/ej2-material3-theme --saveThen add the following CSS reference to the src/App.css file:
@import "../node_modules/@syncfusion/ej2-material3-theme/styles/grid/index.css";Adding Data Grid component
The Data Grid code should be added to the src/App.tsx file.
import { ColumnDirective, ColumnsDirective, GridComponent } from '@syncfusion/ej2-react-grids';
import './App.css';
// Defines the data to be displayed in the Grid.
const data = [
{ OrderID: 10248, CustomerName: 'Ana Trujillo', OrderDate: new Date(2025, 0, 12), ShipCountry: 'France', Freight: 32.38 },
{ OrderID: 10249, CustomerName: 'Martin Sommer', OrderDate: new Date(2025, 0, 15), ShipCountry: 'Germany', Freight: 11.61 },
{ OrderID: 10250, CustomerName: 'Thomas Hardy', OrderDate: new Date(2025, 1, 5), ShipCountry: 'Brazil', Freight: 65.83 },
{ OrderID: 10251, CustomerName: 'Elizabeth Lincoln', OrderDate: new Date(2025, 1, 18), ShipCountry: 'France', Freight: 41.34 },
{ OrderID: 10252, CustomerName: 'Victoria Ashworth', OrderDate: new Date(2025, 2, 10), ShipCountry: 'Belgium', Freight: 51.30 },
{ OrderID: 10253, CustomerName: 'Martine Rance', OrderDate: new Date(2025, 2, 22), ShipCountry: 'Brazil', Freight: 58.17 },
]
function App() {
return <div>
{/* Assigns the dataset to the Grid component */}
<GridComponent dataSource={data}>
{/* Define the columns to be displayed */}
<ColumnsDirective>
<ColumnDirective field='OrderID' headerText='Order ID' width='100' textAlign='Right'/>
<ColumnDirective field='CustomerName' headerText='Customer Name' width='120'/>
<ColumnDirective field='OrderDate' headerText='Order Date' width='100' format='yMd' textAlign='Right'/>
<ColumnDirective field='Freight' width='100' format='C2' textAlign='Right'/>
<ColumnDirective field='ShipCountry' headerText='Ship Country' width='100'/>
</ColumnsDirective>
</GridComponent>
</div>
}
export default App;import { ColumnDirective, ColumnsDirective, GridComponent } from '@syncfusion/ej2-react-grids';
import './App.css';
// Defines the data to be displayed in the Grid.
const data: object[] = [
{ OrderID: 10248, CustomerName: 'Ana Trujillo', OrderDate: new Date(2025, 0, 12), ShipCountry: 'France', Freight: 32.38 },
{ OrderID: 10249, CustomerName: 'Martin Sommer', OrderDate: new Date(2025, 0, 15), ShipCountry: 'Germany', Freight: 11.61 },
{ OrderID: 10250, CustomerName: 'Thomas Hardy', OrderDate: new Date(2025, 1, 5), ShipCountry: 'Brazil', Freight: 65.83 },
{ OrderID: 10251, CustomerName: 'Elizabeth Lincoln', OrderDate: new Date(2025, 1, 18), ShipCountry: 'France', Freight: 41.34 },
{ OrderID: 10252, CustomerName: 'Victoria Ashworth', OrderDate: new Date(2025, 2, 10), ShipCountry: 'Belgium', Freight: 51.30 },
{ OrderID: 10253, CustomerName: 'Martine Rance', OrderDate: new Date(2025, 2, 22), ShipCountry: 'Brazil', Freight: 58.17 },
]
function App() {
return <div>
{/* Assigns the dataset to the Grid component */}
<GridComponent dataSource={data}>
{/* Define the columns to be displayed */}
<ColumnsDirective>
<ColumnDirective field='OrderID' headerText='Order ID' width='100' textAlign='Right'/>
<ColumnDirective field='CustomerName' headerText='Customer Name' width='120'/>
<ColumnDirective field='OrderDate' headerText='Order Date' width='100' format='yMd' textAlign='Right'/>
<ColumnDirective field='Freight' width='100' format='C2' textAlign='Right'/>
<ColumnDirective field='ShipCountry' headerText='Ship Country' width='100'/>
</ColumnsDirective>
</GridComponent>
</div>
}
export default App;@import "../node_modules/@syncfusion/ej2-material3-theme/styles/grid/index.css";Run the application
npm run dev
Registering Syncfusion license
The Syncfusion® React Data Grid requires a valid license key to be registered in the application. To prevent license validation warnings, refer to the Syncfusion licensing documentation.
Troubleshooting
-
Grid not rendering styles: Ensure the theme CSS is imported in
App.cssand that you removed the default Vite CSS inindex.css. -
Trial license warning banner: Register a license key via
registerLicense()from@syncfusion/ej2-base.
NOTE
Looking for the full React Data Grid component overview, features, pricing, and documentation? Visit the React Data Grid page.