Skip to content

Using SASS in React

New Course Coming Soon:

Get Really Good at Git

How to use SASS to style a React application

When you build a React application using create-react-app, you have many options at your disposal when it comes to styling.

Of course, if not using create-react-app, you have all the choices in the world, but we limit the discussion to the create-react-app-provided options.

You can style using plain classes and CSS files, using the style attribute or CSS Modules, to start with.

SASS/SCSS is a very popular option, a much loved one by many developers.

You can use it without any configuration at all, starting with create-react-app 2.

All you need is a .sass or .scss file, and you just import it in a component:

import './styles.scss'

You can see an example of it working at https://codesandbox.io/s/18qq31rp3.

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!
→ Get my React Beginner's Handbook
→ Read my full React Tutorial on The Valley of Code

Here is how can I help you: