react-srcset

0.0.4 • Public • Published

📐🖼️ react-srcset

Pictures dedicated React components

NPM JavaScript Style Guide

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.

Readme

Keywords

none

Package Sidebar

Install

npm i react-srcset

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

86.7 kB

Total Files

7

Last publish

Collaborators

  • yago