I found this stack overflow answer: https://stackoverflow.com/questions/27966468/reactjs-change-background-image-dynamically/27967387
And here’s how I applied it on my code:
var bgImg = {backgroundImage:’url(‘ + props.img + ‘)’,backgroundAttachment:”fixed”,backgroundSize:”cover”}
Note: the code below goes inside return(<>
<section className=’hero position-relative pt-2 pb-5 bg-attachment’ style={bgImg}>
Have any questions or comments? Write them below!