this.setState({
editorState2: EditorState.createWithContent(ContentState.createFromText("hi"))
});
我正在获取json对象,我想在其中将文本分配给draftjs编辑器但是当我尝试分配它时抛出错误
“ PageContainer.js:165未捕获的TypeError:draft_js__WEBPACK_IMPORTED_MODULE_1 __。EditorState.createFromText不是函数”
this.setState({
editorState2: EditorState.createFromText(ContentState.createFromText("hi"))
});
编辑器已经通过构造函数使用]创建了>
constructor(props) {
super(props);
this.state = {
editorState1: EditorState.createEmpty(),
editorState2: EditorState.createEmpty(),
persons: []
};
}
<< [将
this.setState({
editorState2: EditorState.createWithContent(ContentState.createFromText("hi"))
});