0.0.4 • Published 4 years ago

react-srcset v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

📐🖼️ 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.

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago