Skip to content

Instantly share code, notes, and snippets.

@NilsonLima
Created June 10, 2019 22:01
Show Gist options
  • Save NilsonLima/6b462c9807442be9a6378015d5a06397 to your computer and use it in GitHub Desktop.
Save NilsonLima/6b462c9807442be9a6378015d5a06397 to your computer and use it in GitHub Desktop.
basic configuration for a draft-js editor component
import React from "react";
import { Editor, EditorState } from "draft-js";
export default class CustomEditor extends React.Component {
state = { editorState: EditorState.createEmpty() };
onChangeEditor = editorState => this.setState({ editorState });
render() {
const { editorState } = this.state;
return (
<Editor
editorState={editorState}
onChange={this.onChangeEditor}
/>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment