How to apply styles using mergeStyles or makeStyles to the DOM element which is loaded dynamically #33254
Replies: 2 comments
-
Hi @makarandkeer , you can use More about makeStaticStyles: import { makeStaticStyles } from '@griffel/react';
const useStaticStyles = makeStaticStyles({
'@font-face': {
fontFamily: 'Open Sans',
src: `url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff")`,
},
body: {
backgroundColor: 'red',
},
});
function App() {
useStaticStyles();
return <div />;
} |
Beta Was this translation helpful? Give feedback.
-
I don't think you need to do anything special when using This is a basic example but I think you could see how to apply it actual lazy-loaded components and the like: https://stackblitz.com/edit/ypdn1d?file=src%2Fexample.tsx |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have a DIV which loads the DOM elements dynamically and I wanted to apply style to selected DOM element. For example I wanted to apply style for
<p>, <ul>
and other elements.How can I do it, I tried with following code, but it seems to be deprecated
Beta Was this translation helpful? Give feedback.
All reactions