You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-lazy-media

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lazy-media

Lazy load image, picture, video, and iframe media React components

0.2.1
Source
npmnpm
Version published
Weekly downloads
110
17.02%
Maintainers
1
Weekly downloads
 
Created
Source

react-lazy-media

npm Build Status GitHub license

Lazy load image, picture, video, and iframe media React components. react-lazy-media uses vanilla-lazyload under the hood to handle lazy loading.

Polyfilled with the Intersection Observer Polyfill

Installation and Usage:

npm i -S react-lazy-media

Include the Component:

import React from 'react'
import { LazyImage } from 'react-lazy-media'

class Component extends React.Component {

  render() {
    return (
      <LazyImage
        classes={['myLazyImage']}
        src={'./hero.png'}
      />
    );
  }
}

You can import LazyImage LazyVideo LazyIframe LazyBackground LazyWebpPicture respectively.

Component Examples

Every component has id and classes as props to pass down to the media element.

LazyImage

Lazy load an image.

LazyBackground

Lazy load a background image on a div.

LazyVideo

Lazy load an HTML5 video.

LazyIframe

Lazy load an IFrame.

LazyWebpPicture

Lazy load an HTML5 picture that attempts to load a Webp format of an image.

Todo

[] Add tests [] Add code example for each component in readme

Keywords

react

FAQs

Package last updated on 01 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts