Search code examples
reactjspopup

React-portal-popout DOM Error version ^1.9.3


I'm currently using "react-portal-popout": "^1.9.3", and when i popout it, following error message comes out.

"Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17."

Moreover, in my own 'index.js' file, I've already changed my 'index.js' file's DOM version to 18, and just those error comes out only when i used the popup library.

Will there be any way to solve this error?


Solution

  • From React18, react has a bit different structure for creating root element. You'd need to change your index.js file like below;

    import React from 'react';
    import ReactDOM from 'react-dom/client';
    
    const root = ReactDOM.createRoot(document.getElementById('root'));
    root.render(
      <React.StrictMode>
        <App />
      </React.StrictMode>
    );