React JS - Style

We can apply styling in three ways in React :

  1. Stylesheet

  2. Inline Style

  3. CSS with Module
Stylesheet :

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