Hi there! I'm in the process of crafting my portfolio website. My goal is to have a captivating background image on the main page, and once users navigate to other sections of the portfolio, I'd like the background to switch to a solid color. Although changing the backgroundColor was a success, I'm encountering challenges with setting up the backgroundImage properly. Here's a snippet of my code:
componentDidMount(){
this.props.changePage("Main Page");
document.body.style.backgroundImage="url('background.jpg')";
}
Despite following this approach within the main page component, something seems amiss. Could it be an issue with the syntax or perhaps my overall strategy is flawed?
UPDATE 1!!
The piece of code used for backgroundColor worked perfectly fine. So why is there difficulty implementing this for backgroundImage?
componentDidMount(){
this.props.changePage("About Me");
document.body.style.backgroundColor='black';
}