Switch to React 18's createRoot API
https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-client-rendering-apis
This commit is contained in:
parent
85c25903f3
commit
3521e5698f
1 changed files with 4 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
|||
import './precheck';
|
||||
import * as OfflinePluginRuntime from '@lcdp/offline-plugin/runtime';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import { setSwUpdating } from 'soapbox/actions/sw';
|
||||
|
@ -34,9 +34,10 @@ function main() {
|
|||
}
|
||||
|
||||
ready(() => {
|
||||
const mountNode = document.getElementById('soapbox') as HTMLElement;
|
||||
const container = document.getElementById('soapbox') as HTMLElement;
|
||||
const root = createRoot(container);
|
||||
|
||||
ReactDOM.render(<Soapbox />, mountNode);
|
||||
root.render(<Soapbox />);
|
||||
|
||||
if (BuildConfig.NODE_ENV === 'production') {
|
||||
// avoid offline in dev mode because it's harder to debug
|
||||
|
|
Loading…
Reference in a new issue