'How to convert Devextreme React sample code to uses React 18?

DevExtreme React sample application uses ReactDOM.render that was deprecated on React 18.

I converted the code to use ReactDOM.createRoot but the webpage is not rendering properly.

The only file changed is the index.js, I commented old lines and added the new ones. After the changes pages are rendered empty.

packages installed (no the full list)

+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
//file index.js
import './polyfills';
import React from 'react';

//import ReactDOM from 'react-dom';
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>
);

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


reportWebVitals();



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source