0

How to add different background images in react

Want to add diff background for different pages

28th Sep 2020, 4:14 PM
Kahkashan Tabassum
Kahkashan Tabassum - avatar
1 Answer
0
You want the background image to dynamically change depending on the component used? I don't know React, but I would try to pass the path of the image through a prop. You can use HTML img tag or CSS background-image property. Be aware that, at least with Vue.js, if you have the paths to the images in the JavaScript (Instead of having it in static HTML), Webpack will not change them depending on the location of the images at build time.
29th Sep 2020, 3:02 PM
MartĂ­n Stanicio