Answers for "How to set default values for react-draft-wysiwyg"

0

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
Posted by: Guest on June-08-2021

Code answers related to "How to set default values for react-draft-wysiwyg"

Code answers related to "Javascript"

Browse Popular Code Answers by Language