'Is there a way of styling images using styled components in ReactJS?

I have just started working with Styled Components and I 've been running into problems with styling images and I don't mean background images.

export const PrimaryImage = styled.img`
width: 40%;
border-radius: 5px;
height: 50%;
`;

That is what I typed but it won't run of course. So I decided to just wrap the image in a div and style the div

export const PrimaryImage = styled.div`
width: 40%;
border-radius: 5px;
height: 50%;
`;

The div responds but the image doesn't. Is there a way I can target the image itself without having to use a CSS stylesheet?

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source