From the draft-js documention, one can (in vanilla React, with no typescript) setup the Draft-js environment thus, noticing that the onChange
property can be declar
You can use handleChange method like this :
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Editor, EditorState } from 'draft-js';
interface MyEditorProps {
}
class MyEditor extends React.Component {
constructor(props: MyEditorProps) {
super(props);
this.state = { editorState: EditorState.createEmpty() };
}
handleChange(e: EditorState) {
this.setState({ editorState: e });
}
render() {
return (
this.handleChange(e)} />
);
}
}
ReactDOM.render(
,
document.getElementById('editor'),
);
export { MyEditor }