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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-images-queue

v0.0.6

Published

Images loading manager for React

Readme

React Images Queue

This dead simple React HOC allows you to preload images with queueing, specifying number of concurrent images being loaded and reordering images queue

Example

import React from "react";
import { imagesQueue } from "react-images-queue";

class Photo extends React.Component {

  state = {
    activePhoto: 0
  }

  handleClick = () => {
    this.setState({activePhoto: this.props.photos.length - 1 })
    //reorder method is provided by React Images Queue
    //in this example it sets last photo on first position in loading queue
    this.props.reorder(this.props.photos[this.props.photos.length - 1].url)
  }

  render () {
    const photo = this.props.photos[this.state.activePhoto]
    //processedImages is provided by React Images Queue
    return (
      <div>
        <ActivePhoto
          photo={photo}
          isLoaded={this.props.processedImages.map(image=>image.src).indexOf(photo.url) > -1}
        />
        <button onClick={this.handleClick}>Last photo</button>
      </div>
    );
  }
};

export default imagesQueue(props => props.photos.map(photo => photo.url), {size: 2})(Photo)

Installation

npm install react-images-queue --save

Usage

imagesQueue(images, config)

Higher Order Component that wraps other component, gets images and config object as arguments and return wrapped component with injected processed images and reorder method as props.

Arguments

  • images (String or Array or Function): Provides images to load
String
export default imagesQueue('http://images.example/1', {size: 2})(Photo)
Array
export default imagesQueue(['http://images.example/1', 'http://images.example/2', 'http://images.example/3'], {size: 2})(Photo)
Function
export default imagesQueue(props => props.photos.map(photo => photo.url), {size: 2})(Photo)
  • config (Object): Currently allows you to define size property which specifies a number of images loading concurrently

Returns

imagesQueue returns wrapped component with extra props:

  • processedImages (Array): It is an array of objects representing images that loading has been finished with success or error. Each object has following properties:

    src (String) - src of loaded image
    status (String) - loading image status 'error' or 'success'
    time (Number) - UNIX timestamp of finished loading
  • reorder( reorderedImages ) (Function): It is a method that change order of images waiting to be loaded (images queue). You can pass string, array or function as argument. If string or array is passed proper images (or images) are placed on the top of a queue. If function is passed it takes current queue as parameter and should return new queue. Queue is an array of objects with properties: src and callback.

License

MIT