0

I'm triying to import an image from my resources folder and then set it as background-image in a div. See what's I'm doing.

import candidatePortrait from "../../../../../images/candidatePortrait.jpg";

<div
    className="candidate-photo"
    style={{
      backgroundImage: props.photo
        ? `url("${props.photo}")`
        : `${candidatePortrait}`
    }}
  />

I know that my folder path is good but I don't know how to set it as backgroundImage. See my div style. Thanks!

Diego Cardona
  • 355
  • 1
  • 3
  • 12

0 Answers0