Since you're using the ES6 import syntax you may use the same syntax to import your stylesheet

import './App.css'

Also, you can wrap your class with :global to switch to the global scope (this mean CSS Module won't modulify it, eg: adding a random id next to it)

:global(.myclass) {
  background-color: red;
}
Answer from felixyadomi on Stack Overflow
🌐
Medium
medium.com › @toshvelaga › using-global-css-variables-in-react-js-216f03fcdc56
Using Global CSS variables in React JS | by Tosh Velaga | Medium
March 7, 2022 - Wanting to write DRY CSS I decided that I should create some global CSS variables and use them across the app instead of copying and pasting everywhere. This gives us the advantage such that if we need to tweak one of the colors, all we have to do is change the value in one file. First let me provide some background. There are a bunch of different ways to apply styling in a React app.
Discussions

Global styles sheet for CSS modules?
If we have certain styles that are reused (buttons, card/container styling, h1/h2/h3... etc.), would we create a global style sheet with all of those stylings and include it in the App.js? I define main font sizes, font families and colors in a global CSS file but I create separate files for each component. What about if we have multiple variants of these: for example, a small button, a large button, etc? Would we have multiple classes for each of those variants in the global style sheet as well, or would we maybe have a separate style sheet called like buttons.module.css that we could include in our different components and import styles from? I would create a default Button component and define its style using a class like .Button in a file called Button.module.css. I would then create additional classes like .Large or .Small within the same file that can be dynamically added to the Button component based on some prop. My website's CSS needs some refactoring but here's what it looks like at the moment: https://github.com/jnsjknn/website/tree/master/styles More on reddit.com
🌐 r/reactjs
4
2
June 28, 2022
How to Create global styles with Styled components in react and next js and is it better to use combination of css files and styled component?
I started using Styled Components for my Next.js app. Exploring best practices for global styles using Styled Components. First part of the question is how to create global styles with Styled Compo... More on stackoverflow.com
🌐 stackoverflow.com
Where to store global css variables?
I use SASS with CSSModules. Then i keep global variables in different files I import in respective component. Oh, I see that you don’t want to do this. But I don’t think you can. Unless whichever SASS interpreter had a way to import a file together with every other file, which imho sounds incredibly wasteful. More on reddit.com
🌐 r/reactjs
10
11
June 17, 2018
Struggling with React Component Styling – Should I Use Global CSS or Tailwind?
I prefer global-nothing and per-component-Stylesheet. More on reddit.com
🌐 r/reactjs
67
20
October 2, 2024
🌐
Reddit
reddit.com › r/reactjs › is it ok to style a react app with a global css/scss file which lives outside of the whole app?
r/reactjs on Reddit: Is it ok to style a react app with a global CSS/SCSS file which lives outside of the whole app?
September 3, 2022 -

Hi,

TLDR: Code at the end to see how I want to style my app. Doable approach?

I am very new to react and now I need styling. I have seen a lot of ways how people style their react app for instance:

  • css modules

  • styled components

  • tailwind ulitiy first

  • and so on...

The thing is that I dont like all of these solutions (except tailwind but I would use that on top of my styles). I dont see a reason why I should bloat my JS components with styling at all.

So my approach would be like this:

My react components just set class names like class="MyComp__wrap". Then I would style that selector "MyComp__wrap" in an external css/scss file. In my index.html I would just include that css file very early, even before the app is loaded. Just like this: "<link rel="stylesheet" href="/css/index.css">" Almost the same approach would be if I include this css file in the first react app js file (right before "ReactDOM.createRoot") like this "import './css/.index.css';" - But I dont see the reason why I should load the CSS from the react app if I can just do it in the index.html

I think its a super easy approach which does not reinvent the wheel. The components are not bloatet with styles only classNames. Furthermore it reduces complexity because the app does not even know that styling is applied. Classes wouldnt clash because of the nameing schema BEM.

I like this version a lot but of course I dont want to go down a road which is completely against all standards. What do you think?


index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="/css/index.css">
    <title>React App</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="/js/react-app-build.js"></script>
  </body>
</html>

index.js

or I would import the /css/index.css here (but I dont see a reason to do that at the moment therefore I would just stick to the index.html solution):

import './css/index.css'
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(
    <App />
);

SomeReactComp.js

const SomeReactComp = (props) => {
    return (
        <div className='SomeReactComp__wrap'></div>
    );
}

export default SomeReactComp;

css/index.css

.SomeReactComp__wrap {
    backrgound: grey;
}
🌐
Docureacten
docureacten.github.io › managing global styles and themes
Managing Global Styles and Themes | React.js: Learn Easily with Examples
In this section, we'll explore ... in the React ecosystem. Global styles are CSS rules that apply to the entire application, affecting all components unless specifically overridden....
🌐
Bobby Hadz
bobbyhadz.com › blog › react-set-global-css
Applying global CSS styles in a React app | bobbyhadz
April 7, 2024 - To apply global CSS styles in a React app, write your CSS in a file with a `.css` extension and import it in your `index.js` file.
🌐
LearnVern
learnvern.com › react js for web development › global css in react
What is Global CSS in React? - Learn with Experts
Import the main React entry file's global LESS / CSS stylesheet.
Published   October 30, 2021
🌐
Medium
johannblake.medium.com › global-css-in-react-apps-25f846e7b79e
Global CSS with Material-UI Done Correctly in React Apps | by Johann Blake | Medium
March 7, 2020 - The following code, which is launched in your index.js file, loads the css file and parses the css data: ... This is necessary to help React identify the $ character that is reserved for jQuery. The final step is to use the globalCss variable in a React component that will be applied to the entire app.
Find elsewhere
🌐
Max Rozen
maxrozen.com › guide-to-styling-react-app
Methods for styling your React app - Max Rozen
If you still want to use Global CSS in your React app, all you need to do is import the CSS file at the top level of your React app (assuming you've configured webpack to do so, or are using create-react-app).
🌐
Scalablecss
scalablecss.com › styled-components-global-styles
How to Create Global Styles with Styled Components - Scalable CSS
June 2, 2020 - If you’ve opted to use ... your ... globally to an application? ... In this post, I’ll dive into exactly how you can achieve this with the createGlobalStyle function. Please note: This solution is only applicable to web, so this won’t work for react-nat......
🌐
Reddit
reddit.com › r/reactjs › global styles sheet for css modules?
r/reactjs on Reddit: Global styles sheet for CSS modules?
June 28, 2022 -

Relatively new react dev here. I am using css modules in one of my projects. I am familiar basically with how it works, but I have a few questions when it comes to reusable code. If we have certain styles that are reused (buttons, card/container styling, h1/h2/h3... etc.), would we create a global style sheet with all of those stylings and include it in the App.js? What about if we have multiple variants of these: for example, a small button, a large button, etc? Would we have multiple classes for each of those variants in the global style sheet as well, or would we maybe have a separate style sheet called like buttons.module.css that we could include in our different components and import styles from? I guess in general I'm just confused about how to organize the styling of an entire app with css modules. If anyone has a link to a well architected, large code base that uses CSS modules that would be very helpful also, thanks!

🌐
Emotion
emotion.sh › docs › globals
Emotion – Global Styles
import { Global, css } from '@emotion/react' render( <div> <Global · styles={css` .some-class { color: hotpink !important; } `} /> <Global · styles={{ '.some-class': { fontSize: 50, textAlign: 'center' } }} /> <div className="some-class">This is hotpink now!</div> </div> ) (Edit code to see changes) Search ·
🌐
DEV Community
dev.to › diballesteros › how-to-use-global-mixins-and-variables-with-css-modules-in-react-with-sass-37ie
How to use global mixins and variables with CSS Modules in React with SASS - DEV Community
March 21, 2022 - Starting an app with Create-React-App or next a fairly common option is to use CSS Modules which guarantees that the styles per component will not have any conflicts, however, it does mean it’s slightly different to access these global variables.
🌐
DEV Community
dev.to › codeprototype › configuring-both-css-modules-and-global-css-for-reactjs-in-webpack-4ci7
Configuring both CSS Modules and global CSS for ReactJS in Webpack - DEV Community
April 7, 2020 - If we look at the page source, we will see something like _app_header_module_css__WEBPACK_IMPORTED_MODULE_2___default.a.logo as opposed to simply logo in app.css. We don't care about the above heavy lifting that Webpack does, but we have to abide by its requirement. We will need to configure 2 different rules: one for the global CSS and another for CSS module.
🌐
OpenReplay
blog.openreplay.com › using-css-modules-in-react
Using CSS Modules in React
September 2, 2022 - In React js, where classes function similarly to local variables in JavaScript, a CSS Module is just a .css file. It lessens React styling’s global scope. Additionally, it is a tool that prevents global scope and collisions by producing a random string as a className name and adding a unique ...
🌐
Reddit
reddit.com › r/reactjs › where to store global css variables?
r/reactjs on Reddit: Where to store global css variables?
June 17, 2018 -

Hey,

I set up my react project to support sass following this article, which worked out fine (I configured the webpack part slightly different though).

Since I will use a set of different colors throughout my application, I would like to store these into variables, which I can access from my components for example. Since I don't want to import my global.scss file everytime into every components .scss, I would like to somehow set the variables global, making them accessible without imports.

How could I achieve this?

🌐
Syncfusion
syncfusion.com › blogs › react › top 7 ways to write css in your react or next.js app
Top 7 Ways to Write CSS in Your React or Next.js App
November 18, 2024 - Syncfusion React UI components are the developers’ choice to build user-friendly web applications. You deserve them too. ... Global CSS is the most basic approach for styling in Next.js and React apps.
🌐
DEV Community
dev.to › theudemezue › how-to-import-a-css-file-in-react-js-473a
How To Import a CSS File In React JS - DEV Community
March 26, 2025 - Yes, many projects use a mix of both global CSS (for common styles like resets and typography) and CSS Modules (for component-specific styling). For larger projects, consider using code-splitting and lazy loading for CSS files. This can help reduce the initial load time by loading styles only when needed. The official React documentation is a great resource for learning more about styling in React.
🌐
GeeksforGeeks
geeksforgeeks.org › reactjs › global-styling-with-styled-components-in-react
Global Styling with styled-components in React - GeeksforGeeks
July 23, 2025 - It uses tagged template literals ... modularity and reusability. Global Styling: Use GlobalStyle from styled-components to set global styles for body margin, color, and font-family....