Skip to content

Cannot read properties of undefined (reading 'createWithContent') #128

@Oyyou

Description

@Oyyou

Running this code

const html = "<p></p>";
const contentBlock = htmlToDraft(html);
const { contentBlocks, entityMap } = contentBlock;
const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap);
const editorState = EditorState.createWithContent(contentState);

And getting this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'createWithContent')
at TextBoxComponent.tsx:88:1
at commitHookEffectListMount (react-dom.development.js:23150:1)
at commitPassiveMountOnFiber (react-dom.development.js:24926:1)
at commitPassiveMountEffects_complete (react-dom.development.js:24891:1)
at commitPassiveMountEffects_begin (react-dom.development.js:24878:1)
at commitPassiveMountEffects (react-dom.development.js:24866:1)
at flushPassiveEffectsImpl (react-dom.development.js:27039:1)
at flushPassiveEffects (react-dom.development.js:26984:1)
at react-dom.development.js:26769:1
at workLoop (scheduler.development.js:266:1)

I've Googled it a bit, and came across a couple of times it was mentioned, but no concrete solution:
here
and here

Packages:

The code is as basic as it could be - so I'm not sure what the issue could be!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions