π Styling React Components with CSS Modules
CSS Modules generate unique class names for each component, preventing style leakage and conflicts between different components. This ensures that styles are scoped to the specific component.
Create a CSS file name - "style.module.css"
/* style.module.css */
/* Heading style */
.Heading {
color: blue;
font-size: 24px;
}
/* Heading style */
/* Bold style */
.Bold {
font-weight: bold;
}
/* Bold style */
/* style.module.css */Import the file on your react component.
Now use className in following format
If you want to use multiple className : Use this format.
Last updated