npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-lazy-load-img-component

v1.0.4

Published

The React Image Loader Component is a versatile and customizable image loading component for React applications. It provides an elegant way to handle image loading states, such as showing placeholders or loading spinners while the image is being fetched f

Downloads

80

Readme

React Image Loader Component

The React Image Loader Component is a versatile and customizable image loading component for React applications. It provides an elegant way to handle image loading states, such as showing placeholders or loading spinners while the image is being fetched from a server.

Key Features

  • Easy integration: Simply import the component and use it in your React application.
  • Loading state management: loading spinners while images are being loaded.
  • Customizable styling: Easily customize the appearance of the image loader component to match your application's design.

Installation

You can install the React Image Loader Component using npm:

npm install react-lazy-load-img-component

Usage

  • You will need twi images original image and small image as a placeholder. For better performance the small image should be less than 4kb
  • Import the component and use it in your React application like this:
import React from "react"
import ImageComponent from "react-lazy-load-img-component"

const App = () => {
  return (
    <>
      <ImageComponent
        src={img1}
        placeholderSrc={img1Small}
        imageClass="img"
        loader="spinner"
        alt="a topical beach with a lot of palm trees with beautiful sea water"
      />
      <ImageComponent
        src={img2}
        placeholderSrc={img2Small}
        imageClass="img"
        loader="pulse"
        alt="a pinkish water with a big beautiful boulder in the middle that has a few small trees on the top of it"
      />
    </>
  )
}

export default App

Props

The React Image Loader Component accepts the following props:

  • src (string, required): The source URL of the image to be loaded.
  • placeholderSrc (string, required): The placeholder small image to be displayed while the image is loading.
  • className (string): custom class for the image wrapper.
  • imageClass (string): custom class for the image.
  • loader (string): choose loader style choose: spinner, pulse, or leave it empty.