Reputation: 6158
I currently have a <Login/>
page, and a <Dashboard/>
.
The login page has a background of #222
, and when you login the Dashboard has a background of whitesmoke
The way I am doing this is having this on the body css:
body {
background-color: #222222;
}
and this in the Dashboard.js
:
componentWillMount() {
document.body.style.backgroundColor = "whitesmoke";
}
componentWillUnmount() {
document.body.style.backgroundColor = null;
}
Up to now, this was working. But I now have an Image as my background on the Login page, as seen here:
body {
background-color: #222222;
background: url('../../public/img/bg.png');
background-repeat: repeat;
}
but my Dashboard inherits the background image, even when I put something like this:
componentWillMount() {
document.body.style.backgroundImage = null;
document.body.style.backgroundColor = "whitesmoke";
}
componentWillUnmount() {
document.body.style.backgroundColor = null;
}
How do I get around this? Thanks
Upvotes: 0
Views: 184