I am using create-react-app
and I am trying to work out an "efficient" way to apply stylesheets to specific pages.
My src
folder structure looks something like this:
| pages
| - About
| - - index.js
| - - styles.css
| - Home
| - - index.js
| - - styles.css
| index.js
| index.css
In each of the index.js
files I use import './style.css'
However, I'm finding that when I navigate from one page to the next the styles from the starting page are being applied to the target page as if they're being cached and the styles from the target page are not being followed.
I just wondered if I'm misunderstanding how to apply styles in React to specific pages. Should I be making entirely self contained components which incude the styles too?
I am considering applying them inline but I realise there are limitation when using JS styles.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…