Does not work with next js when tools are added
See original GitHub issueThe solution to use dynamic imports worked for react-editor-js but when I load the tools, it has the same error as in issue before. Please fix this.
https://github.com/Jungwoo-An/react-editor-js/issues/31
Error is TypeError: Cannot read property 'holder' of undefined
Here is my code:
import dynamic from 'next/dynamic';
const EditorJS = dynamic(
() => import('react-editor-js'),
{ ssr: false }
)
const Header = dynamic(
() => import('@editorjs/header'),
{ ssr: false }
)
const Embed = dynamic(
() => import('@editorjs/embed'),
{ ssr: false }
)
const Table = dynamic(
() => import('@editorjs/table'),
{ ssr: false }
)
const Paragraph = dynamic(
() => import('@editorjs/paragraph'),
{ ssr: false }
)
const EDITOR_JS_TOOLS = {
header: Header,
embed: Embed,
table: Table,
paragraph: Paragraph,
}
useEffect(() => {
setEditorTools(EDITOR_JS_TOOLS)
}, []);
and for editor
DOES NOT WORK
<EditorJS tools={editorTools}/>
WORKS
<EditorJS />
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Advanced Features: Next.js Compiler
Learn about the Next.js Compiler, written in Rust, which transforms and minifies your Next.js application.
Read more >Advanced Features: Debugging - Next.js
Next, open Chrome's Developer Tools ( Ctrl + Shift + J on Windows/Linux, ⌥ + ⌘ + I on macOS), then go to...
Read more >Blog - Next.js 13
Next.js 13 introduces layouts, React Server Components, and streaming in the app directory, as well as Turbopack, an improved image ...
Read more >Getting Started | Next.js
Get started with Next.js in the official documentation, and learn more about all our features!
Read more >Advanced Features: Dynamic Import - Next.js
Dynamically import JavaScript modules and React Components and split your code into manageable chunks.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi Rahul, Actually I had another issue when I try to unmount this editor which I could not fix so I did not use this editor at all,
However what I did to fix this issue was
Would you please share more working code? The examples you are giving don’t make much sense. Where exactly would you integrate the NoSSR function @Jungwoo-An ? Did you mix it with @StarAzure 's “NOSSRComponent”? If you could possible share a codesandebox of this working with Next.js, I would be eternally grateful.