Big fan of inline styles and decided to give it a try. I'm slowly getting the hang of it but I'm now stuck because I keep getting the "Unknown prop styles on <img> tag" error.
My code is as shown below:
render(){
let imgUrl = 'http://mrmrs.io/images/0006.jpg';
let divStyles = {
backgroundImage:'url(" + imgUrl + ")',
backgroundSize: 'cover'
};
return(
<main class="cf w-100">
<div class="fl w-50 w-third-m w-25-ns">
<div class="aspect-ratio aspect-ratio--1x1">
<img styles="{{divStyles}}" class="db bg-center cover aspect-ratio--object" />
</div>
</div>
</main>
)
}
The simple stuff are always the ones that give me the most problems. Any help would be appreciated.
classtoclassNameand also when thedivStylesis an object just use it asstyle={divStyles}styleprop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX."