Ask anything to Sass Team

View other answers to this thread
Gustavo Andres's photo

Which is the recommended way to use Sass with React? Should I merge my Sass code with the .js code, or should I put my Sass code apart from the .js code? Do you guys know a tutorial, article or something about this? Hampton, please, show me some light about this, you are using React in Rent the Runway, right?

Michael Mifsud's photo

There's no one right way. Do what works for you and your team. Most of my dat to day is still stand-alone compiled CSS and JSX files. On newer projects I like using CSS Modules to import my Sass into React.

This is a great overview https://www.youtube.com/watch?v=aIyhhHTmsXE

Hampton Catlin's photo

The official "Create-React" app puts a twin CSS file next to the JS file. That's what I do.

Store.js and Store.scss sit next to each other. And in Store.scss I wrap everything in .Store which is the class of the React Component.