Home > Back-end >  styling standard reactjs project
styling standard reactjs project

Time:01-25

I have created a react project by npx create-react-app my-app.

There are App.css and index.cssin src folder of project. I want to style my index.js project but neither of css files are responsible.

What are those files for and how can I globally style my project?

CodePudding user response:

What are those files for

Don't know

how can I globally style my project?

import a css file in index.js

// index.js
import './somecssfile.css'

...

CodePudding user response:

What are those files for?

When you use CRA (create-ract-app), the app.css & index.css files are there to style the basic react app you get with the CTA template. I know the naming is a bit confusing. Check this issue on CRA github board: Misleading css files

how can I globally style my project?

To style your app there are lots of ways: CSS Modules, styled-compoment (my fav ourite) ... check out this great article: 5 Ways to style your react app

  • Related