Executes a function after the DOM has loaded.
Install the module
npm install @wordpress/dom-ready --save
import domReady from '@wordpress/dom-ready';
domReady( function() {
//do something after DOM loads.
} );
See https://make.wordpress.org/design/handbook/design-guide/browser-support/