wp_back/wp-content/plugins/visual-portfolio/gutenberg/components/styles-render/index.js

21 lines
434 B
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
import { useEffect } from '@wordpress/element';
/**
* Render dynamic styles for editor.
*
* @param root0
* @param root0.children
* @return {null} nothing.
*/
export default function StylesRender({ children }) {
useEffect(() => {
const node = document.createElement('style');
node.innerHTML = children;
document.body.appendChild(node);
return () => document.body.removeChild(node);
}, [children]);
return null;
}