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

react-background-image

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-background-image

Display a placeholder image while the real image loads, featuring different preloading and animation options

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

react-background-image

Display a placeholder image while the real image loads.

NPM JavaScript Style Guide

Install

npm install --save react-background-image

Usage

import React from 'react';
import BackgroundImage from 'react-background-image';
import placeholder from './images/small.jpg';
import hdImage from './images/large.jpg';

export default function App() {
  return (
    <div className='main'>
      <BackgroundImage
        placeholder={placeholder}
        src={hdImage}
        className='myCustomClass'
        {...otherProps}
      >
        <p className='some-class'>Other element</p>
        <OtherReactComponent />
      </BackgroundImage>
    </div>
  );
}

Props

PropTypeNotes
srcStringHD image to load
placeholderStringPlaceholder image to be immediately displayed
classNameStringOptional custom css class

Demo

https://jonatanramhoj.github.io/react-background-image/

License

MIT © jonatanramhoj

Keywords

react

FAQs

Package last updated on 18 Oct 2022

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