我想使用Facebook的draftjs组件,但我遇到了一些障碍。
import React from 'react';
import ReactDOM from 'react-dom';
import { Editor, EditorState } from 'draft-js';
class MyEditor extends React.Component{
constructor(props) {
super(props);
this.state = {
editorState: EditorState.createEmpty()
};
this.onChange = (editorState) => this.setState({ editorState });
}
render(){
var {editorState} = this.state;
return(
<Editor editorState={ editorState } onChange={ this.onChange } />
);
}
}
ReactDOM.render(
<MyEditor />,
document.getElementById('container')
);这是我写的,but=>代码
Warning: A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.
console.error(message);我按如下所示更改了代码,并成功实现了=>
render(){
var {editorState} = this.state;
return(
<div>富文本编辑器</div>
);
}

但这就是为什么呢?
发布于 2016-04-12 13:47:30
在react 15.0.0 Link中已修复此问题。
https://stackoverflow.com/questions/36469123
复制相似问题