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. Learn more: https://reactjs.org/link/switch-to-createroot
const root = document.getElementById('root');
ReactDOM.createRoot(rootNode).render()
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { Provider } from 'react-redux';
import store from './app/store'
const root = document.getElementById('root');
ReactDOM.createRoot(root).render(
<Provider store = {store}>
<App />
</Provider>
)
->err : Argument of type 'HTMLElement | null' is not assignable to parameter of type 'Element | DocumentFragment'
"dependencies": {
"@types/react-dom" 의 버전(18 이상)
"types": [
"react/next",
"react-dom/next", ],
if (!root) throw new Error('Failed to find the root element');
///OR
const root = document.getElementById('root') as HTMLElement;