All docs
V19.2
19.2
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
17.1
The page you are viewing does not exist in version 17.1. This link will take you to the root page.
16.2
The page you are viewing does not exist in version 16.2. This link will take you to the root page.

TypeScript Support

DevExtreme React components are supplied with TypeScript declarations. Strict typing allows you to catch bugs at earlier stages and use features like code completion and automated refactoring.

The following code shows an example of using TypeScript with DevExtreme components:

App.tsx
import * as React from 'react';
import List from 'devextreme-react/list';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

interface IListItemProps {
    text: string;
}

interface IComponentState {
    counter: number;
}

const items: IListItemProps[] = [
    { text: "Item 1" },
    { text: "Item 2" },
    { text: "Item 3" }
];

class Item extends React.Component<IListItemProps, IComponentState> {
    constructor(props: IListItemProps) {
        super(props);
        this.state = {
            counter: 0
        };
        this.addCounter = this.addCounter.bind(this);
    }

    public render() {
        return (
            <div onClick={this.addCounter}>
                {this.props.data.text} was clicked {this.state.counter} times
            </div>
        );
    }

    private addCounter() {
        this.setState({
            counter: this.state.counter + 1
        });
    }
}

class App extends React.Component {
    render() {
        return (
            <List items={items} itemComponent={Item} />
        );
    }
}

export default App;