| @@ -11,9 +11,8 @@ | ||
| 11 | 11 | * WordPress dependencies. |
| 12 | 12 | */ |
| 13 | 13 | import { StrictMode } from 'react'; |
| 14 | 14 | import { createPortal, createRoot } from 'react-dom'; |
| 15 | -import domReady from '@wordpress/dom-ready'; | |
| 16 | 15 | import { addFilter } from '@wordpress/hooks'; |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | 18 | * Initializes a React component on the page. |
| @@ -21,18 +20,16 @@ | ||
| 21 | 20 | * @param {string} rootId HTML ID of the root element for the component. |
| 22 | 21 | * @param {Component} Component JSX component. |
| 23 | 22 | */ |
| 24 | 23 | export const initializeReactComponent = ( rootId, Component ) => { |
| 25 | - domReady( () => { | |
| 26 | - if ( process.env.DEVELOP ) { | |
| 27 | - Component = <StrictMode>{ Component }</StrictMode>; | |
| 28 | - } | |
| 24 | + if ( process.env.DEVELOP ) { | |
| 25 | + Component = <StrictMode>{ Component }</StrictMode>; | |
| 26 | + } | |
| 29 | 27 | |
| 30 | - const root = document.getElementById( rootId ); | |
| 31 | - if ( root ) { | |
| 32 | - createRoot( root ).render( Component ); | |
| 33 | - } | |
| 34 | - } ); | |
| 28 | + const root = document.getElementById( rootId ); | |
| 29 | + if ( root ) { | |
| 30 | + createRoot( root ).render( Component ); | |
| 31 | + } | |
| 35 | 32 | }; |
| 36 | 33 | |
| 37 | 34 | /** |
| 38 | 35 | * Initializes a React component on the page, in a React Portal, and registers its meta box. |