react-markdown-editor-lite icon indicating copy to clipboard operation
react-markdown-editor-lite copied to clipboard

wht I getting this error when i try to write in the editor [object object]

Open am0029 opened this issue 2 years ago • 1 comments

why I getting this error when i try to write in the editor [object object]

i did everthing ok this happens when i want write something into editor just said [object object]

am0029 avatar Jan 01 '23 18:01 am0029

Hi @am0029 I am assuming this is because onChange event returns an object and not a value. the object looks like this:

{
        text: string;
        html: string;
}

so you have to make sure when you are setting the state you are actually setting the text as a state and not the complete object.

Maybe updating your code to something like this help:

 <MdEditor onChange={(value) => setEditorValue(value.text)} />

Delwalt avatar Jan 28 '23 13:01 Delwalt