How to set default values for react-draft-wysiwyg code example
Example: How to set default values for react-draft-wysiwyg
import React, { Component } from 'react'
import { EditorState, ContentState, convertFromHTML } from 'draft-js'
import { Editor } from 'react-draft-wysiwyg'
class MyEditor extends Component {
constructor(props) {
super(props)
this.state = {
editorState: EditorState.createWithContent(
ContentState.createFromBlockArray(
convertFromHTML('<p>My initial content.</p>')
)
),
}
}
render() {
return <Editor editorState={this.state.editorState} />
}
}
export default MyEditor