how to set default values for react draft wysiwyg

Solutions on MaxInterview for how to set default values for react draft wysiwyg by the best coders in the world

showing results for - "how to set default values for react draft wysiwyg"
Miranda
30 Mar 2018
1import React, { Component } from 'react'
2import { EditorState, ContentState, convertFromHTML } from 'draft-js'
3import { Editor } from 'react-draft-wysiwyg'
4
5class MyEditor extends Component {
6  constructor(props) {
7    super(props)
8    this.state = {
9      editorState: EditorState.createWithContent(
10        ContentState.createFromBlockArray(
11          convertFromHTML('<p>My initial content.</p>')
12        )
13      ),
14    }
15  }
16
17  render() {
18    return <Editor editorState={this.state.editorState} />
19  }
20}
21
22export default MyEditor