editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

[Bug]Double instance in react

Open devmnj opened this issue 2 years ago • 1 comments

I got a render error regarding dom/client in React. I am using the react-editor-js library. I fix the issue temporarily using the ReactDom render as follows

Problematic Index.js

`import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root')); root.render( <React.StrictMode> <App /> </React.StrictMode> );

`

After the fix

`import ReactDOM from "react-dom"; import React from "react"; // import { createRoot } from "react-dom/client";

import App from "./App";

const rootElement = document.getElementById("root"); // const root = createRoot(rootElement); ReactDOM.render(<App />, rootElement); `

devmnj avatar May 31 '22 05:05 devmnj

Did you run it locally? React.StrictMode makes instance twice in development mode. Remove StrictMode and try again.

zziuni avatar Jun 15 '22 12:06 zziuni