Disable the datetimepicker component in React Datetimepicker component

24 Jan 20231 minute to read

To disable the DateTimePicker, use its enable property to false.

import { DateTimePickerComponent } from '@syncfusion/ej2-react-calendars';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
export default class App extends React.Component {
    enable = false;
    render() {
        return <DateTimePickerComponent id="datetimepicker" enabled={this.enable} placeholder='Select a date and time'/>;
    }
}
ReactDOM.render(<App />, document.getElementById('element'));
import { DateTimePickerComponent } from '@syncfusion/ej2-react-calendars';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

export default class App extends React.Component<{}, {}> {

    private enable:boolean=false;

    public render() {
        return <DateTimePickerComponent id="datetimepicker" enabled={this.enable} placeholder='Select a date and time' />;
    }
}
ReactDOM.render(<App />, document.getElementById('element'));