-1

I have a string from API request like this.

const test = **test**↵***nice***↵;

The "test" should be bold and "nice" should be bold and italic. I am using this code in my component but it shows the *.

this.setState({
    editorState: EditorState.createWithContent(
      ContentState.createFromText(nextProps.value)
    ),
});
B.V
  • 109
  • 2
  • 13

1 Answers1

1

Draft.js by default does not have any knowledge of markdown syntax, you'd need to use a third party tool to convert markdown to a draft-consumable format. A quick google search should find you what you need; there are several such tools out there!

Here's a few:

Rose Robertson
  • 1,236
  • 7
  • 14