Created
June 10, 2019 22:01
-
-
Save NilsonLima/6b462c9807442be9a6378015d5a06397 to your computer and use it in GitHub Desktop.
basic configuration for a draft-js editor component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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