How To Change Styles While Route Changing In React?
When route(react-route) changing, how can I load or remove the styles relevant to the new page? I really don't know who is in charge of this function , react or webpack or react-ro
change it like this
Page1:
import style from'./page1style.css';
exportdefaultclassPage1extendsReact.Component {
render () {
return<divclassName={style.someClass} />
}
}
what your code does is to load as general css and that's why it load all of it. This way would be more modular and easy to handle
You may like these posts
Post a Comment for "How To Change Styles While Route Changing In React?"