Skip to content

Instantly share code, notes, and snippets.

@marawannwh
Last active March 5, 2016 18:44
Show Gist options
  • Save marawannwh/c6aabbb7a3d21a1dfade to your computer and use it in GitHub Desktop.
Save marawannwh/c6aabbb7a3d21a1dfade to your computer and use it in GitHub Desktop.
var React = require('react');
var Editor = require('draft-js').Editor;
var EditorState = require('draft-js').EditorState;
var MyEditor = React.createClass({
getInitialState: function() {
return {editorState: EditorState.createEmpty()};
},
onChange: function(editorState) {
this.setState({editorState})
},
render: function() {
editorState = this.state
return (
<Editor editorState={editorState} onChange={this.onChange} />
)
},
});
module.exports = MyEditor;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment