Files
openpanel/packages/devtools/src/components/apply-styles.tsx
Stefan Pejcic 09f9f9502d packages
2024-11-07 19:03:37 +01:00

20 lines
380 B
TypeScript

import React from "react";
type Props = {
children: string;
};
export const ApplyStyles = ({ children }: Props) => {
React.useEffect(() => {
const element = document.createElement("style");
element.innerHTML = children;
document.head.appendChild(element);
return () => {
document.head.removeChild(element);
};
}, [children]);
return null;
};