0

I need to access the public folder /images folder in reactjs. since we have jsx I was able to access that in the following the way

let x= window.location.origin + '/image/myimage.jpg';

However, I need to access the same folder inside app.css

.breadcum-header {
    height: 25vh;
    background-image: url('../../../public/img/myimage.jpg')

}

I'm getting the following error when I try to do so. is there any alternative way?

enter image description here

coding_Lover
  • 393
  • 1
  • 4
  • 13
  • are you using create react app ? – keysl Oct 04 '19 at 04:49
  • yes i'm using create react app – coding_Lover Oct 04 '19 at 05:55
  • Depending on whether you are working on dev or prod, you can control different parameters, take a look at the [documentation](https://create-react-app.dev/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env), it should help. – Grzegorz T. Oct 04 '19 at 06:26
  • Possible duplicate of [Correct path for img on React.js](https://stackoverflow.com/questions/37644265/correct-path-for-img-on-react-js) – Grzegorz T. Oct 04 '19 at 06:32

0 Answers0