MERN-Stack-Typescript-Blog icon indicating copy to clipboard operation
MERN-Stack-Typescript-Blog copied to clipboard

ReferenceError: window is not defined

Open SaadAli11 opened this issue 1 year ago • 0 comments

I am using nextjs with typescript and I found this error when I use html-to-draftjs library ReferenceError: window is not defined

how can I resolve this issue??

useEffect(() => {

if (handle?.description !== null && handle?.description !== undefined) {
  const contentBlock = htmlToDraft(handle.description);
  const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
  const editorState = EditorState.createWithContent(contentState);

  setEditorState(editorState);

}}

Screenshot_3

SaadAli11 avatar Dec 06 '23 06:12 SaadAli11