You don't even have to name it if you don't need to:

e.g.

import React from 'react';
import './App.css';

see a complete example here (Build a JSX Live Compiler as a React Component).

Answer from code4jhon on Stack Overflow
🌐
Create React App
create-react-app.dev › docs › adding-a-stylesheet
Adding a Stylesheet | Create React App
import React, { Component } from 'react'; import './Button.css'; // Tell webpack that Button.js uses these styles class Button extends Component { render() { // You can use them as regular CSS styles return <div className="Button" />; } } Copy · This is not required for React but many people find this feature convenient. You can read about the benefits of this approach here. However you should be aware that this makes your code less portable to other build tools and environments than webpack. In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them.
🌐
W3Schools
w3schools.com › react › react_css.asp
React CSS
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
🌐
Saleh Mubashar
salehmubashar.com › blog › different-ways-to-add-css-in-react-js
Different Ways to add CSS in React JS
Learn how to create a search bar in React here! You can create a new CSS file in your project directory and add your CSS inside it. It can then be imported into your React component or class.
🌐
Locofy
locofy.ai › blog › 5-ways-to-handle-css-in-react
5 Ways to Handle CSS in React | Locofy Blogs
It can be really intimidating & that's where you can use CSS modules while building a website. For that, you must create a style.module.css file and import it into the relevant React file. So your specific styles will get added only where you want.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-style-react-apps-with-css
How to Style Your React App – 5 Ways to Write CSS in 2021
July 16, 2021 - Therefore, CSS modules are best to use over CSS and SASS to make sure classes don't conflict and to write predictable styles that only apply to one or another component. ... Similar to how React allowed us to write HTML as JavaScript with JSX, CSS-in-JS has done something similar with CSS. CSS-in-JS allows us to write CSS styles directly in our components' javascript (.js) files. Not only does it allow you write CSS style rules without having to make a single .css file, but these styles are scoped to individual components. In other words, you can add, change or remove CSS without any surprises.
🌐
Educative
educative.io › answers › what-are-the-different-ways-to-add-css-in-react-js
What are the different ways to add CSS in React JS?
Inline CSS is probably the most common and quickest out of the three methods to add CSS to a React app.
Find elsewhere
🌐
LambdaTest
lambdatest.com › home › blog › how to style and write css in react
How To Style And Write CSS In React | LambdaTest
November 8, 2023 - It allows you to write encapsulated and scoped CSS in React to style your component(s). Run the below-mentioned command to install styled JSX: Post that, add styled-jsx/babel to plugins in your babel configuration: Now you can start using styled jsx in your React application.
🌐
Create React App
create-react-app.dev › docs › adding-a-css-modules-stylesheet
Adding a CSS Modules Stylesheet | Create React App
CSS Modules allows the scoping of CSS by automatically creating a unique classname of the format [filename]\_[classname]\_\_[hash]. Tip: Should you want to preprocess a stylesheet with Sass then make sure to follow the installation instructions and then change the stylesheet file extension as follows: [name].module.scss or [name].module.sass.
🌐
Codefinity
codefinity.com › courses › v2 › 1dcaf86a-11aa-492e-8e1d-06e055479aa9 › 9ec57b72-9bc2-4c0a-b012-d4fdfbd7900e › ff5f9719-6819-4058-964a-9ab3eea77c7b
Learn Styling Components with External CSS | Styling React Applications
To use the styles, import the CSS file into your component file: import "./styles.css"; const App = () => ( <> <h1 className="title">App title</h1> </> ); In React, the class attribute is written as className because class is a reserved keyword ...
🌐
GeeksforGeeks
geeksforgeeks.org › reactjs › how-to-import-a-css-file-in-react
How to import a CSS file in React ? - GeeksforGeeks
July 23, 2025 - Note : In index.js file write this code this will apply the cs using the internal css: In this code we have used the internal css where all the css is defined in the <head> tag using the <style>, below is the code snippet: ... import React from 'react'; import ReactDOM from 'react-dom'; ReactDOM.render( <> <head> <style> {` * { margin: 0; } body { background-color: aqua; } h1 { border-radius: 20px; background-color: rgb(251, 141, 196); text-align: center; margin-top: 100px; } `} </style> </head> <body> <h1>hello Geek!!</h1> </body> </>, document.getElementById("root") );
🌐
Medium
medium.com › @dmitrynozhenko › 9-ways-to-implement-css-in-react-js-ccea4d543aa3
9 Ways To Implement CSS in React JS | by Dmitry Nozhenko | Medium
October 15, 2019 - With more than 7.7K ⭐️ on GitHub ... popular CSS-in-JS libraries. Emotion provides a powerful and a predictable style composition in addition to a great developer experience with features such as source maps, labels, and testing utilities. Both string and object styles are supported. ... If you don’t use this line, “Emotion” won’t work. Today we’ve explored 9 ways of adding styles in ReactJs application...
🌐
DEV Community
dev.to › salehmubashar › 3-ways-to-add-css-in-react-js-336f
Different Ways to add CSS in React JS - DEV Community
April 23, 2023 - You can create a new CSS file in your project directory and add your CSS inside it. It can then be imported into your React component or class. The following code is used to import an external CSS stylesheet.
Top answer
1 of 8
47

A first read through your question makes it seem that your existing CSS isn't working when you 'React-ify' your webpage.

It should.

If it's not, there's something else going on that will need further diagnosing to fix. I recently rewrote one of my projects in React and continued to use the exact same CSS file and things worked great.

However, if you're asking about the best way to go about this...

As others have said, React prefers inline styles.

However, I don't. It's messy, can be difficult to change, and easily gets unwieldy.

SCSS or LESS are the best ways to style in React.

But why? Here are a few reasons:

Your CSS Is Reusable

If you style inline with the React way, it works great for a couple components.

But when those components start to stack up, you start realizing you're using the same styles again and again. Which sucks.

It's Easy to Make Changes

When a component needs an updated style, you no longer have to dig through your React code to find the right component (or was it the parent component?) and fix it.

Instead, just use CSS like you've always used.

You Don't Have to Worry About Overwriting

In the cascading part of CSS, inline styles are the final stop. They overwrite everything.

At first, it sounds like a great solution to the styles you're implementing, and in a brochure website, perhaps it would be fine. But when you start working with bigger apps, you run into issues that are almost impossible to troubleshoot.

Instead of fighting with the cascading part of CSS, work with it and keep your styles in the same place.

You Use SCSS & LESS Everywhere

The biggest point for me is yes, if you're working in React and you prefer inline styles, they can work great.

But what happens when you move to any other framework? All of a sudden those inline styles don't work so well, and you're back to writing 'normal' CSS with the rest of us. So why change things up just for one framework?

I understand if you work in React full-time and it makes sense to experiment with new best practices, but for most of us, it doesn't make sense to re-invent the wheel when you only can use that wheel on one model of car.

2 of 8
13

If you want to keep things compartmentalized, you could create a .scss file for the specific component you are styling then import it in your component file.

Example:

Folder Structure:

components
|
|--Card
   |
   |--Card.js
   |--Card.scss
   |--index.js
|--Some Other Component Folder 

Card.js:

import React, { Component } from 'react';
import classes from './Card.scss';

export class Card extends Component {

    render () {
        return (
            <div className={`${classes.layout} col`}>
                <div className={`${classes.card} card`}>
                    <div className="card-image">
                        <ProviderImage />
                    </div>
                </div>
            </div>
        );
    }
}

export default Card;

Card.scss:

.layout {
    img {
        display: block;
        max-width: 372px;
        max-height: 372px;
        height: auto;
        width: auto;
    }
}

.card {
    width: 370px;
    height: 550px;
}

This keeps the styles contained to its respective component.

🌐
W3Schools
w3schools.com › react › react_css_styling.asp
React CSS Styling
Note: The styles will only be available for the component that imported it. Another way of adding styles to your application is to use CSS Modules. CSS Modules are convenient for components that are placed in ...
🌐
Medium
pxcode.medium.com › how-to-import-css-file-in-react-js-a-comprehensive-guide-0c536b74fcdd
How to import CSS file in React JS : A Comprehensive Guide | by pxCode | Medium
March 21, 2024 - This means styles defined in a component’s CSS module are scoped to that component, eliminating the risk of naming collisions. import styles from './App.module.css'; function App() { return ( <div className={styles.App}> <header ...
🌐
React
legacy.reactjs.org › docs › faq-styling.html
Styling and CSS – React
We want to hear from you!Take our 2021 Community Survey! ... render() { let className = 'menu'; if (this.props.isActive) { className += ' menu-active'; } return <span className={className}>Menu</span> } ... If you often find yourself writing code like this, classnames package can simplify it. Yes, see the docs on styling here. CSS classes are generally better for performance than inline styles.
🌐
Angular Minds
angularminds.com › blog › guide-to-writing-css-in-your-react-projects
Guide to Writing CSS in Your React Projects
June 4, 2024 - Integrating it into your project may require additional configuration in your build tool setup. It generates unique class names for each component, which could lead to slightly larger bundle sizes compared to traditional CSS. In conclusion, CSS Modules offer a powerful solution for managing styles in React applications, providing modularity, scoped style, and avoidance of naming conflicts.
🌐
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 - If you haven’t created one yet, you can start by running the following command in your terminal: ... Inside your project directory, locate the src folder. Create a file named App.css if it doesn’t exist already.