Using CSS Classes in JSX

Learn how to style React components using the built-in classnames package.

Declaring classes

It is much cleaner and nicer to use real CSS classes in JSX, just like we do in regular HTML, with the difference being that we declare classes by using className instead of class:

<div className="item">...</div>

React renders normal syntax with our HTML equivalent:

<div class="item">...</div>

It is also quite common to concatenate ...

Get hands-on with 1400+ tech skills courses.