here am getting an image from props, I have to make that image as a background image for a particular element. I achieved this using styled-components. But in my app, we are not using styled components anywhere, so I am trying to achieve this using inline styles. Because it's dynamic we couldn't or may not be able to pass this image to the CSS file.
this is my method using styled-components, anyway to change this using inline styles, please help me with that, Thanks
Styled Components
const BannerImage = styled.div`
&::after {
background: url(${(props) => props.image}) no-repeat;
content: '';
background-size: cover !important;
background-position: center center !important;
right: 0;
height: 100%;
position: absolute;
left: 0;
}
@media (min-width: 992px) {
&::after {
right: calc((-1%) - ((100vw - 992px) / 2));
}
}
`;
Element used styled component
<BannerImage
image={image}
className="col-lg-6 col-md-16 col-sm-12 col-12 h-100 d-flex"
/>