P粉1112278982023-08-03 12:21:28
You can try using styles. title. < h1 className = {styles.heading} >Hello! My style is scss</h1>
P粉7878060242023-08-03 10:19:52
You can use :global to declare that you are using a global class
So main. modules. scss will become
.heading { font-size: 4rem; color: #000; } :global(.dark) .heading { color: #fff; }
Why is this happening?
The scope of CSS modules is the components they use.
This means by default. The dark selector will be compiled and will not reference the global one. dark category.