'what is the correct way to use Sass and React JS?

I have a question. I´m Learning how to use React JS 18v. My question is: what is the best way to use Sass with React? how do you compile it? I don't want to use an extension of VSC to compile.

I will be greatfull if someone can help me :)



Solution 1:[1]

I've been using sass for quite some time, and learned that the best way to compile and use it is to turn it into css beforehand: use Koala compiler. Koala is super easy to use and will compile your sass into css lighting fast. Afterwards, just use the css file as normal :D

Solution 2:[2]

Actually you can use Styled Components instead pure Sass. It's a react library using Sass syntax out there, but the most value is, that you can pass the props to render styles conditionally, that makes it super useful. https://styled-components.com/docs/basics

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lordsanken
Solution 2 Andrzej Musiol