css – next/react not loading style with variables in classname


The problem is, for example, I have .styleA in A.module.css, and in A.js, after styleA is imported correctly, if I use <div className={styleA}> ..., it is working correctly, and I can see the style is applied. However, if I do const style="styleA" first, then do <div className={style}> ..., the style won’t working anymore. The reason is I need to use different styles according to different values, but when I set up the className to be variable, the style doesn’t seem to be working.



Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here