Rachid L'harime
Rachid L'harime

Reputation: 59

CSS styles aren't applying in my React app

When I add new HTML code to my React app , the CSS styles from the App.css file aren't applying anymore , until I retype Import './App.css'" in the head. Any solution please.

Upvotes: 1

Views: 1439

Answers (2)

Rachid L'harime
Rachid L'harime

Reputation: 59

Problem solved , it was about bootstrap .

Import bootstrap/dist/css/bootstrap.min.css before App.css .

I was doing the opposite .

Upvotes: 2

Imran Rafiq Rather
Imran Rafiq Rather

Reputation: 8118

All our components in React act like modules and have their data (variables, functions) private to them. To access code or styles from other files we need import from other modules.

Our App.js is also one such component. Until you do import './App.css', the CSS will not be applied to App.js.

Upvotes: 1

Related Questions