react-srcset
v0.0.4
Published
Pictures dedicated React components
Downloads
2
Readme
📐🖼️ react-srcset
Pictures dedicated React components
Install
yarn add react-srcset
// or
npm install --save react-srcset
Usage
import React, { Component } from 'react'
import { PictureProvider, Picture } from 'react-srcset'
const options = {
srcParameters: ['host'],
setSrc: ({ w, h, ext, host }) => `https://${host}/${w}x${h}.${ext}`,
};
const MyComponent = () => (
<PictureProvider options={options}>
<Picture
ratio={ratio}
sm={sm}
md={md}
lg={lg}
alt={alt}
host="dummyimage.com"
/>
</PictureProvider>
);
For (a lot) more information, 📗 read the interactive documentation
Contribute
First, install all dependencies:
$ yarn
$ cd ./example && yarn
To ease both module and example contributions, start the following commands in paralel.
$ yarn start
# AND
$ cd ./example && yarn start
License
MIT © Antistatique
This library is created using create-react-hook.