I'm using styled components in my react js project. when constructing my styled component img, I want the background to be dependent on the props the component gets. If i'm building a functional component I just use:
const FramedImage = styled.img`
background-size: cover;
background: URL(${props.imageUrl});
background-position: center center;
background-repeat: no-repeat;`;
inside the component and it works.
but how can I achieve the same with class components? since I can't declare a const var inside the class itself, and out side of it, there is no this.props
Thanks!