MERN-Stack-Typescript-Blog
MERN-Stack-Typescript-Blog copied to clipboard
ReferenceError: window is not defined
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);
}}