We can apply styling in three ways in React :
- Stylesheet
- Inline Style
- CSS with Module
We create a style.css file under src/ folder and link it in the component.
In React, className="" is used instead of class=""
Output :
Inline Style :
We write Inline CSS.
Output :
CSS with Module :
We create custom.module.css file under src/ folder and link it in the component file. In the component, we import style and we use className="{style.class}" on the element.
Output :
Comments
Post a Comment