Skip to content

Commit

Permalink
Merge pull request #44 from reedoooo/clean/styledAndCustomComponents
Browse files Browse the repository at this point in the history
added root render
  • Loading branch information
reedoooo authored May 4, 2024
2 parents 9517fec + 8f6e099 commit bd399d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ReactDOM from 'react-dom';
import { BrowserRouter as Router } from 'react-router-dom';
import App from './App';
import { register, unregister } from './serviceWorker';
import { createRoot } from 'react-dom/client';

// ==============================|| REACT DOM RENDER ||============================== //

Expand All @@ -15,7 +16,9 @@ import { ParallaxProvider } from 'react-scroll-parallax';
import { HelmetMetaData } from 'data';

const domNode = document.getElementById('root');
if (!domNode) throw new Error('Failed to find the root element');

const root = createRoot(domNode); // Create a root.
const AppWrapper = () => {
const { theme } = useMode();
const errorHandler = (error, errorInfo) => {
Expand Down Expand Up @@ -49,7 +52,7 @@ const AppWrapper = () => {
);
};

ReactDOM.render(<AppWrapper />, domNode);
root.render(<AppWrapper />); // Use the root to render the AppWrapper.

if (process.env.NODE_ENV === 'production') {
register(); // Only register the service worker in production
Expand Down

0 comments on commit bd399d1

Please sign in to comment.