remove jquery-in-react

This commit is contained in:
paul sealock 2024-08-29 11:54:30 +12:00
parent 60f0d04e1c
commit 9db7e547f1
1 changed files with 11 additions and 2 deletions

View File

@ -45,8 +45,17 @@ const Settings = ( { params } ) => {
sidebarVisisble sidebarVisisble
); );
const event = new Event( 'reactRendered' ); // Append a new script tag
window.dispatchEvent( event ); const script = document.createElement( 'script' );
script.src =
'http://localhost:8888/wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js';
script.async = true;
document.body.appendChild( script );
// Cleanup function to remove the script when the component unmounts
return () => {
document.body.removeChild( script );
};
}, [ params.page, section, sidebarVisisble ] ); }, [ params.page, section, sidebarVisisble ] );
// Register the slot fills for the settings page just once. // Register the slot fills for the settings page just once.