I am trying to create an "avatar" component using Gatsby with typescript. Thee component is supposed to use a local image. My component looks like
const avatar: React.FC<Props> = ({imageUrl, title}: Props) => (
<div className="avatar" title={title} style={{backgroundImage: `url(${imageUrl})`}} />
);
And I am calling it with
<Avatar title={"Avatar"} imageUrl={"../avatar/elements.png"} />
The path to the file is correct, however it's not showing up. What am I doing wrong?
P.S. Is there a way to make the image go through gatsby-image for being optimized?