From b30fd54e2fcc658a95984f5bc8128a301a059589 Mon Sep 17 00:00:00 2001 From: Marko Duspara Date: Fri, 9 May 2025 16:03:43 +0200 Subject: [PATCH] refactor: remove deprecated ReactDOM.findDOMNode usage --- examples/index.jsx | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/examples/index.jsx b/examples/index.jsx index 0a4cf74..0128b9c 100644 --- a/examples/index.jsx +++ b/examples/index.jsx @@ -1,20 +1,13 @@ -import React from 'react' -import ReactDOM from 'react-dom' -import { AppContainer } from 'react-hot-loader' -import App from './App' +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import App from './App'; -const render = Component => { - ReactDOM.render( - - - , - document.getElementById('app'), - ) -} +const rootElement = document.getElementById('app'); +if (!rootElement) throw new Error("Root element not found"); -render(App) - -// Webpack Hot Module Replacement API -if (module.hot) { - module.hot.accept('./App', () => { render(App) }) -} +const root = createRoot(rootElement); +root.render( + + + +); \ No newline at end of file