New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-dumb-image

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dumb-image

A React component for providing a fallback img solution

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

react-dumb-image

Build Status Coverage Status

Motivation

When dealing with third-party API, more than often I have to deal with external images. react-dumb-image provides an easy solution to show a fallback image if given image is invalid. This is achieved by creating an image new Image() on the fly and verify whether or not the src is valid by attaching onerror event. I didn't use react onerror (e.g. <img onError={this.handleError} src={src} />) because users will see a 'flip' from broken image to fallback image.

Usage

import React from 'react';
import DumbImage from 'react-dumb-image';

React.render((
  <DumbImage
    src="invalid.jpg"
    default="valid.jpg"
  </DumbImage>
), document.body);

FAQs

Package last updated on 22 Apr 2016

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