Skip to content

Commit

Permalink
refactor: 💡 Use createRoot (React 18) (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanz authored Apr 24, 2024
1 parent 0963c0c commit 008c49f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
import './main.css';

import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';

import URL from 'url-parse';
import 'whatwg-fetch';
import { version } from '../package.json';
import { App } from './js/components/app';

import { EMSClient } from '@elastic/ems-client/target/node';

import { App } from './js/components/app';

start();

async function start() {
Expand All @@ -41,10 +43,11 @@ async function start() {
};

const serviceName = config.serviceName || 'Elastic Maps Service';
const container = document.getElementById('wrapper');
const root = createRoot(container);

ReactDOM.render(
root.render(
<App client={emsClient} serviceName={serviceName} layers={emsLayers} />,
document.getElementById('wrapper')
);
}

Expand Down

0 comments on commit 008c49f

Please sign in to comment.