Styled React Components (CSS in JS)

CSS in JS helps to write CSS as JavaScript. It will compile to CSS either is runtime or build time depends on your configurations.

There are several libraries to write CSS in JS. The most popular ones are,

  • Emotion
  • Styled components
  • Styled JSX

The main advantage of CSS in JS is,

  • You can create styles as a component
  • Reusability and Maintainability of code in JS files together

You can check out our blog post on React styled components using Emotion library here to learn more.

In the next lesson, we will use a styled component library Emotion to build our FAQ styles.