DevExtreme UI and Visualization Components for React
DevExtreme React is a comprehensive suite of UI and visualization components for React applications, providing high-performance, enterprise-grade widgets such as data grids, charts, editors, and navigation controls. These components act as React wrappers around the core DevExtreme JavaScript library. The current stable version is 25.2.6. DevExtreme typically follows a structured release cadence with two major updates per year (e.g., 25.1, 25.2) and frequent patch releases, often monthly or bi-monthly, ensuring continuous improvements and bug fixes. Key differentiators include an extensive feature set within components (like advanced data binding, filtering, and grouping in the DataGrid), a consistent API, and comprehensive documentation. It is particularly well-suited for complex business applications requiring a rich, responsive user interface. While the `devextreme-react` package itself is MIT licensed, the underlying DevExtreme components require a commercial license from DevExpress for production use.
Common errors
-
TypeError: Cannot read properties of undefined (reading 'setup') / Error: E0024 - 'dx.all.js' or 'dx.web.js' module is not referenced.
cause This typically means the core DevExtreme JavaScript logic or themes are not properly loaded or initialized before a DevExtreme component is rendered.fixEnsure you have correctly imported the DevExtreme CSS themes (e.g., `import 'devextreme/dist/css/dx.light.css';`) and that your `devextreme` package is installed and accessible. Check for any missing scripts if not using a module bundler. -
ReferenceError: DataGrid is not defined
cause The specific DevExtreme React component (e.g., `DataGrid`) was not correctly imported into the component file.fixAdd the correct import statement for the component, typically a default import from its specific path, e.g., `import DataGrid from 'devextreme-react/data-grid';`. -
E2001 - Data of an unsupported type was provided to a UI component.
cause DevExtreme UI components, especially data-bound ones, expect specific data types (e.g., an array of objects for a DataGrid's dataSource). Providing an incompatible type will cause this error.fixReview the documentation for the specific component's `dataSource` or other data-bound properties and ensure the data you are providing matches the expected format and types. -
Invariant Violation: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130
cause This is a generic React error, but with DevExtreme, it can often indicate issues with React version compatibility or incorrect component usage within the React lifecycle.fixVerify that your `react` and `react-dom` versions satisfy the `devextreme-react` peer dependency requirements. Check your component's `render` method for common React pitfalls like returning multiple elements without a fragment, or incorrect state updates.
Warnings
- gotcha DevExtreme is a commercial product. While `devextreme-react` itself is MIT licensed, using the underlying DevExtreme components in production requires purchasing a commercial license from DevExpress. Without a valid license, trial messages or warnings may appear.
- breaking Major version upgrades of DevExtreme (e.g., from v24.x to v25.x) often introduce breaking changes in component APIs, behavior, or underlying dependencies. `devextreme-react` versions typically align with the core `devextreme` package, meaning its minor/major versions reflect these breaking changes.
- gotcha DevExtreme themes must be explicitly imported from the `devextreme/dist/css` path. Failing to do so will result in unstyled components, impacting the visual appearance and user experience.
- breaking The `devextreme-react` package requires specific React and `devextreme` peer dependency versions. Using incompatible versions can lead to runtime errors or unexpected behavior. For instance, recent versions might require React 17+.
- gotcha DevExtreme components can have performance implications with very large datasets or complex configurations if not optimized. Features like virtualization, lazy loading, and server-side data processing are crucial for maintaining responsiveness.
Install
-
npm install devextreme-react -
yarn add devextreme-react -
pnpm add devextreme-react
Imports
- DataGrid
import { DataGrid } from 'devextreme-react'; // Incorrect, specific component path neededimport DataGrid, { Column, Editing, Paging } from 'devextreme-react/data-grid'; - Button
const Button = require('devextreme-react/button'); // CommonJS is not the primary usage pattern for modern React apps with this library.import Button from 'devextreme-react/button';
- dx themes
import 'devextreme-react/dist/css/dx.light.css'; // Themes are part of the core 'devextreme' package, not 'devextreme-react'.
import 'devextreme/dist/css/dx.light.css'; import 'devextreme/dist/css/dx.material.blue.light.css';
Quickstart
import React from 'react';
import DataGrid, { Column, Paging, Pager, Editing, Popup, Form, RequiredRule } from 'devextreme-react/data-grid';
import 'devextreme/dist/css/dx.material.blue.light.css'; // Or another theme
const employees = [
{ id: 1, firstName: 'John', lastName: 'Doe', city: 'New York', position: 'Developer' },
{ id: 2, firstName: 'Jane', lastName: 'Smith', city: 'London', position: 'Designer' },
{ id: 3, firstName: 'Peter', lastName: 'Jones', city: 'Paris', position: 'Manager' },
// More data...
];
function App() {
const onRowInserting = (e) => {
// Simulate API call for adding a new employee
console.log('Inserting row:', e.data);
employees.push({ ...e.data, id: employees.length + 1 });
e.component.refresh(true);
};
const onRowUpdating = (e) => {
// Simulate API call for updating an employee
console.log('Updating row:', e.newData, 'for:', e.oldData);
Object.assign(employees.find(emp => emp.id === e.key), e.newData);
e.component.refresh(true);
};
const onRowRemoving = (e) => {
// Simulate API call for removing an employee
console.log('Removing row with key:', e.key);
const index = employees.findIndex(emp => emp.id === e.key);
if (index > -1) {
employees.splice(index, 1);
}
e.component.refresh(true);
};
return (
<div className="app-container" style={{ margin: '20px' }}>
<h2>DevExtreme DataGrid with Basic CRUD</h2>
<DataGrid
dataSource={employees}
keyExpr="id"
showBorders={true}
onRowInserting={onRowInserting}
onRowUpdating={onRowUpdating}
onRowRemoving={onRowRemoving}
>
<Paging defaultPageSize={10} />
<Pager showPageSizeSelector={true} allowedPageSizes={[5, 10, 20]} showInfo={true} />
<Editing
mode="popup"
allowAdding={true}
allowUpdating={true}
allowDeleting={true}
useIcons={true}
>
<Popup title="Employee Info" showTitle={true} width={700} height={340} />
<Form>
<RequiredRule message="First Name is required" />
<RequiredRule message="Last Name is required" />
<RequiredRule message="Position is required" />
</Form>
</Editing>
<Column dataField="firstName" caption="First Name" />
<Column dataField="lastName" caption="Last Name" />
<Column dataField="city" caption="City" />
<Column dataField="position" caption="Position" />
</DataGrid>
</div>
);
}
export default App;