我正在使用useEditor
TipTap 库中的函数来创建一个编辑器,但它首先返回 null。我的意思是,如果我使用useEditor
并立即记录我设置的变量,它会返回 null,但之后会返回一个 Editor 对象。我将 React 与 create-react-app 一起使用。
我的 App.js 文件中有这个:
const editorUse = useEditor({
extensions: [StarterKit],
content: JSON.parse(localStorage.getItem("text")) ?? "",
});
console.log(editorUse);
代码沙箱:https ://codesandbox.io/s/zealous-darwin-iswww?file=/src/App.js