我在一个项目上使用 Next.js,其中编辑器组件(EditorJS 找到https://github.com/Jungwoo-An/react-editor-js)无法使用 SSR。在下一个文档之后,我尝试在页面上动态导入我的编辑器组件。当我加载页面时,除了编辑器组件之外的所有组件都会加载。
使用 Chrome 开发工具中的 ReactComponents选项卡,它向我显示编辑器组件卡LoadableComponent在加载阶段。
编辑器代码 (Editor.js)
import React from "react";
import axios from 'axios';
import EDITOR_JS_TOOLS from "./editor-constants"
import EditorJs from "react-editor-js"
// const DynamicComponent = dynamic(() => import("react-editor-js").then((mod) => mod.EditorJs) ,{"ssr" : false})
import { API_LINK, getDoc } from "../services"
/* Document editor for a given forum */
export default function Editor(props) {
/* API call to save current document state */
async function saveDoc() {
const ENDPOINT = …Run Code Online (Sandbox Code Playgroud)