braposo / react-responsive-picture

A future-proof responsive image component that supports latest Picture specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support use for background image or provide example code for it

mjamil0 opened this issue · comments

I tried to use it for background image but it doesn't work. I'm new to react so I'm not really sure if I'm doing it correctly:

render() { return ( <div> <FullsizePicture sources = {[ { srcSet: "https://images.unsplash.com/photo-1470619549108-b85c56fe5be8?dpr=2&auto=format&w=1024&h=1024", } ]} > <header className="App-header"> <h1 className="App-title">Welcome!!!</h1> </header> </FullsizePicture> </div> ); };

img is a void element tag and must neither have children nor use dangerouslySetInnerHTML.
in img (created by Img)
in Img (created by Picture)
in picture (created by Picture)
in Picture (created by FullSizePicture)
in div (created by PictureWrapper)
in PictureWrapper (created by FullSizePicture)
in div (created by Wrapper)
in Wrapper (created by FullSizePicture)