Reputation: 59
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
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
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