If using create-react-app then:

1)First install sass dependency using npm:

npm install sass --save-dev

2)Import your sass file to your componentName.js file

import '../scss/FileName.scss';

Answer from restricted-beam on Stack Overflow
🌐
Create React App
create-react-app.dev › docs › adding-a-sass-stylesheet
Adding a Sass Stylesheet | Create React App
To share variables between Sass files, you can use Sass's @use rule. For example, src/App.scss and other component style files could include @use "./shared.scss"; with variable definitions.
🌐
W3Schools
w3schools.com › react › react_sass_styling.asp
React Sass Styling
To add Sass to a React project, you need to install the Sass package: ... Now you are ready to include Sass files in your project! Create a Sass file the same way as you create CSS files, but Sass files have the file extension .scss:
🌐
Reddit
reddit.com › r/reactjs › how to use sass in react?
r/reactjs on Reddit: How to use Sass in React?
April 19, 2022 -

Hey,

So far in my React projects I've been putting all my Sass files in a "styles" folder inside src. Basically I import the files that correspond to each component into the main Sass file that's then compiled to CSS. But I get why this wouldn't be a scalable solution, as the number of files grows it could get confusing to know which Sass file corresponds to which JS component.

I know there's styled components, which is definitely something I'm going to try in my next project, but for the current one I want to use Sass. So I tried using CSS modules but it's really tedious to have to import every Sass class as a variable into the JS component. Unless I'm missing something.

I guess another alternative to what I've been doing would be to have the Sass files in the same folder as their respective components and then still import everything into the main Sass file. But for some reason this doesn't feel right, so is there a better way to use Sass in React?

Top answer
1 of 3
3
What you can do is use css modules and scss together. npm install sass Create a file called "test.module.scss" Import the file into the file you need those styles import styles from"./test.module.scss", you can call the "styles" import what you want. Use the styles from the file Ex.

lorem ipsum

2 of 3
1
CSS modules are a bit overrated if you just pick and use a decent prefix for all class names, although you're definitely overstating the tedium However, I think you're a bit misunderstanding what webpack does for you: > I guess another alternative to what I've been doing would be to have the Sass files in the same folder as their respective components and then still import everything into the main Sass file To be clear, this is the best pattern: component-scoped styles sit in a folder alongside the component JSX/TSX file, and they only impact that component. However, you don't need to "import everything into the main sass file", you just do this: MyComponent index.tsx style.scss MyComponent/style.scss: .PrefixedMyComponent { border: 1px solid var(--theme-border); border-radius: 8px; ... } MyComponent/index.tsx: // dependencies import React from 'react'; // styles import './style.scss'; export interface IMyComponentProps { children: any; // I have a type called RenderableContent for this situation } export function MyComponent(props: IMyComponentProps) { return {props.children}; } Then webpack makes one big browser-compatible CSS file for you when you run the "build" command
🌐
Medium
medium.com › @bobjunior542 › how-to-use-scss-in-reactjs-f62433a126f5
How to use SCSS in Reactjs | by Bob Junior | Medium
March 8, 2023 - The node-sass package is the actual SCSS compiler, while the sass-loader package is a Webpack loader that allows you to use SCSS in your Webpack-based build process. Once you have installed the dependencies, you can update your Webpack configuration to use the sass-loader. If you are using the create-react-app tool to create your ReactJS application, you can update the configuration in the package.json file:
🌐
GeeksforGeeks
geeksforgeeks.org › reactjs › how-to-style-with-sass-scss-in-react
How to style with SASS/SCSS in React ? - GeeksforGeeks
July 23, 2025 - //App.js import React, { Component } from 'react'; import './App.scss'; class App extends Component { render() { return ( <div className="gfg"> <h1>Geeks for Geeks</h1> </div> ); } } export default App; ... //app.scss .gfg { background-color: ...
🌐
Tim Smith
iamtimsmith.com › blog › how-to-use-styles-in-a-react-js-application
How to Use Sass and Styled Components in a React JS Application | Tim Smith
// sass/app.scss @import "./variables"; @import "./elements"; @import "./components/socialcard"; And just like that, here is the final Social Card component with our sass styles. It looks the same as the component did in Styled Components. ... As you can see, both Sass and Styled Components are valuable ways to supercharge styles in React js applications. Ultimately, I think that you should use the one that you enjoy using the most.
🌐
DEV Community
dev.to › readymadecode › how-to-use-scss-in-react-4jja
How to use SCSS in React? - DEV Community
April 2, 2023 - It is also used as a file extension for SASS(syntactically awesome style sheets). SCSS Code are executed on the server and sends CSS to the browser. In SCSS, we can create dynamic css using the variable, conditions, looping etc. In this tutorial we will learn how to use SCSS in react.
Find elsewhere
🌐
MakeUseOf
makeuseof.com › home › programming › how to use sass in react
How to Use Sass in React
July 1, 2023 - You can start using Sass in React by installing the sass package via npm or yarn, updating your CSS files to .scss or .sass, then updating your imports to use the new file extension.
🌐
Reddit
reddit.com › r/reactjs › what are the best practices for using scss for styling react projects?
r/reactjs on Reddit: What are the best practices for using SCSS for styling React projects?
August 14, 2022 -

I want to learn the folder structure, code writing conventions etc. Any help or resource will be appreciated :)

Feel free to DM as well.

Top answer
1 of 8
7
I've been following the ideology of what I see development teams use for angular and other similar projects. I have one main SCSS folder where I have anything global. Anything I want across the entire site or app. Usually on the index.js or app.js is where I will import the SCSS file that puts everything together. Beyond that, I try to think in terms of components. So let's say I have a folder that contains the JavaScript file for a component or maybe a page in this app or website, I will have an SCSS file in there with styles that are specific to just that item or page, and import it in through that one JS file. So really, as things are being used, it's pulling in different things when needed. As opposed to one big giant global style sheet across the entire app. Actually like doing things like that. I think I would even take this same ideology if I was doing a static HTML and CSS site.
2 of 8
6
What I’d do is have a global CSS file to store common things that cover the whole app, background Color’s, box sizing, reset etc. And then each component that requires styles will have its own file. If you are wanting variables for common things like spacing, Color’s etc, look up design tokens on how that can be done. Usually just a second global file called “tokens” or “design”. Honestly with this pattern you probably don’t need SCSS at all and can use plain CSS instead to remove the Ruby dependency, but if you’re more comfortable with it then do it up.
🌐
YouTube
youtube.com › watch
Using SASS (SCSS) in React | Tutorial - YouTube
Long CSS files with lots of repetition can be really hard to work with, so let's take a look at how SCSS or SASS might be able to help with that.I hope this ...
Published   April 25, 2022
🌐
Medium
medium.com › how-to-react › use-sass-in-react-js-bbeb0b94f8a6
Use SASS in React js. In this tutorial, we will discuss Sass… | by Manish Mandal | How To React | Medium
September 22, 2020 - 2. Now install the node-sass module to your react project. yarn add node-sass · 3. In your project src directory create an app.scss file. 4. Now add the below code in your app.js file · 5. Open your app.scss file and add below sass code there.
🌐
Altcademy
altcademy.com › blog › how-to-use-scss-in-reactjs
How to use scss in ReactJS
July 5, 2023 - Now that our environment is set up, let's write some SCSS. In your 'src' folder, create a new file called 'App.scss'. This is where we will write our SCSS code. // Define a variable $primary-color: blue; // Use the variable body { background-color: ...
🌐
LogRocket
blog.logrocket.com › home › how to use sass in react native
How to use Sass in React Native - LogRocket Blog
June 4, 2024 - This means that when you use webpack or a module bundler to build your code, it compiles your Sass files too. In the web ecosystem, your Sass files are saved with the .scss extension instead of the regular .css extension. The SCSS stands for “Sassy CSS” and provides a syntactic sugar that’s similar to CSS. You can also write raw CSS inside your Sass files because every valid CSS is also a valid SCSS. However, vice versa is not true. Since React Native does not use CSS but style objects, your Sass files are also converted to React Native style objects under the hood.
🌐
YouTube
youtube.com › watch
React and Sass Tutorial - Intro to SASS - YouTube
Hey guys in this video I will show you how to configure and setup sass in a React environment. Then I will show you the fundamental features existing in the ...
Published   June 8, 2021
🌐
Medium
medium.com › officialrajdeepsingh › how-to-add-scss-sass-in-react-js-6615b6e77e56
How to add scss/sass in react.js? | by Rajdeep singh | Rajdeep Singh | Medium
December 13, 2021 - import React from "react";//import scss file in your componenetimport "./styles.scss";export default function App() {return (<><div className="card"><img className='image' src="https://source.unsplash.com/random" alt=' use image by unspash API ...
🌐
Mitrais
mitrais.com › home › reactjs with sass/scss
ReactJS with SASS/SCSS | Mitrais
June 30, 2022 - //variable example $i-want-turquoise: turquoise $i-want-black: black $i-want-purple: purple //mixin example @mixin div-style width: 100% height: 100% align-items: center display: flex justify-content: center @mixin p-style padding: 20px font-size: 60px font-weight: bold text-align: center //interpolation example @mixin div-theme($name, $bg-color, $color) #{$name} background-color: #{$bg-color} color: #{$color} //the line below is an example of how to call the interpolation method @include div-theme(".black", $i-want-black, $i-want-purple) @include div-theme(".purple", $i-want-purple, $i-want-b
🌐
YouTube
youtube.com › watch
How to use Sass in React | Use SCSS in React JS
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
Medium
medium.com › nerd-for-tech › add-sass-to-your-react-app-in-2021-here-is-how-c7260c323a5a
Add Sass to your React App in 2021! Here is how. | by Austin Evans | Nerd For Tech | Medium
March 14, 2021 - Now we will see “sass” version “^1.32.8” in our package.json file under our devDependencies. Next we should make some folders to stay organized. In your src folder, add a a Sass folder and a Css folder. In our Sass folder, add an App.scss ...
🌐
DEV Community
dev.to › officialrajdeepsingh › how-to-add-scss-sass-in-react-js-58hg
How to add scss/sass in react.js? - DEV Community
May 3, 2021 - Steps: 1.Install node-sass: npm install node-sass 2.Change file extension .css to .scss 3.Import your .scss files in your React components ... https://codesandbox.io/s/how-to-add-scsssass-inreactjs-04wg0?fontsize=14&hidenavigation=1&theme=dark · Conclusion: my thought read this article you definitely use sass or scss in your project any problem, query, suggestion tell me to comment below.