I am getting json object in which I want to assign text to draftjs editor but when I try to assign it it throw error
"PageContainer.js:165 Uncaught TypeError: draft_js__WEBPACK_IMPORTED_MODULE_1__.EditorState.createFromText is not a function"
this.setState({
editorState2: EditorState.createFromText(ContentState.createFromText("hi"))
});
Editor was already created from constructor with
constructor(props) {
super(props);
this.state = {
editorState1: EditorState.createEmpty(),
editorState2: EditorState.createEmpty(),
persons: []
};
}
change EditorState.createFromText to EditorState.createWithContent
this.setState({
editorState2: EditorState.createWithContent(ContentState.createFromText("hi"))
});