7 CSS in JavaScript

This chapter covers

  • Making your applications look great
  • Evaluating the many ways to add styling
  • Exploring three ways to style a component

Creating functional apps is a good start, but ensuring that they look gorgeous as well is going to make users love using your apps. Making HTML websites look good is the job of CSS, which is notoriously different from HTML and JavaScript, which we are using in the world of React.

We will be examining three different ways of styling React applications and evaluating their strengths and weaknesses:

  • CSS files and class names
  • CSS Modules
  • Styled-components

I will cover them in this order, which is their order of complexity and learning curve. The first option requires almost ...

Get React in Depth now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.