yuanyan / react-image

Enhanced Image Component for React.
MIT License
36 stars 5 forks source link

This project has been superseded by https://github.com/mbrevda/react-image.

and is no longer being activly devloped!

React Image

Image Component for React.

Demo & Examples

Live demo: yuanyan.github.io/react-image

To build the examples locally, run:

npm install
gulp dev

Then open localhost:9999 in a browser.

Installation

The easiest way to use react-image is to install it from NPM and include it in your own React build process (using Browserify, etc).

You can also use the standalone build by including dist/react-image.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

npm install react-image --save

Usage

var React = require('react');
var Img = require('react-image');
var App = React.createClass({

    imgs: [
        "//placebacon.net/200/150 400w",
        "//placebacon.net/300/300 600w",
        "//placebacon.net/400/400 800w",
        "//placebacon.net/800/800 1000w"
    ],

    render: function() {

        return (
            <Img alt="Bacon..." srcset={this.imgs.join(', ')} class="baconImg"/>
        );
    }

});

Properties

Events

TODO