Skip to content

Commit 6c486f3

Browse files
committed
updated readme.md
1 parent de791f6 commit 6c486f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ npm install html-to-draftjs --save
1111

1212
## Using
1313
```
14+
import { EditorState, ContentState } from 'draft-js';
1415
import htmlToDraft from 'html-to-draftjs';
1516
16-
const blocksFromHTML = htmlToDraft(this.props.content);
17-
const contentState = ContentState.createFromBlockArray(blocksFromHTML);
17+
const contentBlock = htmlToDraft(html);
18+
const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
1819
const editorState = EditorState.createWithContent(contentState);
1920
```

0 commit comments

Comments
 (0)