I am trying to display a background image in a div and though it works fine for a standard img tag I can't make it work for the div.
What am I doing wrong?
Below is where I import the image:
import imgPackage from '../img/package.png';
And below is the 2 pieces of code - div doesn't display anything and img works fine.
<div
style={{
height: '50px',
width: '50px',
backgroundImage: 'url(${ imgPackage })'
}}
/>
<img src={imgPackage} alt="Smiley face" height="42" width="42" />
In the div backgroundImage I tried the following and none worked
backgroundImage: 'url(${ imgPackage })'
backgroundImage: 'url('+{ imgPackage }+')'
backgroundImage: 'url(../img/package.png)'
What am I doing wrong? Thanks!