For anyone experiencing similar issue where Editor JS content is rendered empty, disabling strict mode works. Remove React.StrictMode enclosure tags from App.jsx or App.tsx file.
//From this
root.render(
<React.StrictMode>
<BrowserRouter basename='admin'>
<App />
</BrowserRouter>
</React.StrictMode>
);
//Change to this
root.render(
<BrowserRouter basename='admin'>
<App />
</BrowserRouter>
);
Answer from Nish on Stack Overflow
ยป npm install react-editor-js
reactjs - React-editor-js not showing up in a functional component - Stack Overflow
Editor.js
Which rich text editor is compatible with react 19?
Which Rich Text Editor to use ?
Videos
For anyone experiencing similar issue where Editor JS content is rendered empty, disabling strict mode works. Remove React.StrictMode enclosure tags from App.jsx or App.tsx file.
//From this
root.render(
<React.StrictMode>
<BrowserRouter basename='admin'>
<App />
</BrowserRouter>
</React.StrictMode>
);
//Change to this
root.render(
<BrowserRouter basename='admin'>
<App />
</BrowserRouter>
);
Your code should work, something outside of it or the way you are rendering the component is probably the issue.
Here's a working example using a functional component:
CreateNewPost.js
import { useState } from "react";
import { createReactEditorJS } from "react-editor-js";
import { EDITOR_JS_TOOLS } from "./constants";
const ReactEditorJS = createReactEditorJS();
const CreateNewPost = () => {
const [editorValue, setEditorValue] = useState({
time: new Date().getTime(),
blocks: [
{
type: "header",
data: {
text: "Testing title",
level: 2
}
},
{
type: "paragraph",
data: {
text:
"We have been working on this project more than three years. Several large media projects help us to test and debug the Editor, to make it's core more stable. At the same time we significantly improved the API. Now, it can be used to create any plugin for any task. Hope you enjoy. "
}
}
],
version: "2.1.0"
});
return <ReactEditorJS tools={EDITOR_JS_TOOLS} data={editorValue} />;
};
export default CreateNewPost;
index.js
import React from "react";
import { createRoot } from "react-dom/client";
import CreateNewPost from "./CreateNewPost";
const container = document.getElementById("app");
const root = createRoot(container);
root.render(<CreateNewPost />);
Hello everyone, could someone please help me? I need to create a Notion-style editor, and the best option seems to be using the Editor.js library. However, I'm finding it quite challenging to add styles that look good, especially with Tailwind CSS.