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

supercharged-list

v1.0.6

Published

High Performance list

Downloads

455

Readme

Supercharged-List

A High Performance List for React Applications.

What's this all About ?

A memoized component which means that it will not re-render if props remain shallow-equal. But here come a twist, if the prop in list is an object and its content remain same, then also it will re-render as it will not remain shallow-equal due to different memory assigned to objects. So here comes the supercharged-list to overcome this situation. In this it will perform the diff checker of the previous and next props object. It will render only if there is diffrence in the content of object. This will not re-render the entire list with props as object.

The List could be rendered in either of 3 ways:

  1. Default Behaviour: Entire List to be rendered in one go. (autoLoad=false && loadOnScroll=false)
  2. The List items rendered in batches automatically. (autoLoad=true)
  3. The List Items rendered in batches on scrolling. (loadOnScroll=true)

Features:

  1. Diff checker to render only those list items whose props is changed.
  2. Can scroll to a particular List Item in the List to be rendered.

Install

With npm:

npm install --save supercharged-list

or with yarn:

yarn add supercharged-list

Props

| Prop | Type | Description | Default | Required | | --- | --- | --- | --- | --- | | data | array | Data to be rendered in the list | null | Required | | renderItem | function that return a JSX element | Template of a row in supercharged-list | null | Required | | itemKey | String if data is array of object | To assign React key to each List Item | "id" | Required if data is array of object | | autoLoad | boolean | To render List in batches automatically | false | Optional | | batchCount | number | Number of List Items to be rendered in one batch | 50 | Required if autoLoad or loadOnScroll is true | | loadOnScroll | boolean | To render List in batches on scroll | false | Optional | | scrollParent | selector | View Port in which the List is scrolled | window | Required if loadOnScroll is true | | isTabular | boolean | Used to create an extra html tag for reference to each List Item. It should be true if List Item is a table row of Table. If isTabular is true, "tr" tag is used for reference else "span" tag is used. | false | Required | | positionToScroll | Number | Array Index of List Item to be scrolled to in data to be rendered | null | Optional | | onScrollToElementEnd | function | Function to be called after scrolled to particular List Item | empty function | Optional |

Usage

Here is a basic usage:

import React from "react";
import FlatList from "supercharged-list";

const usersData = [
  { id: 1, name: "xyz", age: 12 },
  { id: 2, name: "abc", age: 24 },
  { id: 3, name: "pqr", age: 18 },
  { id: 4, name: "klm", age: 35 }
];

class Example extends React.Component {
  constructor(props) {
    super(props);
    this.renderItem = this.renderItem.bind(this);
  }
  renderItem(item) {
    return <JSXListElement props={item} />;
  }
  render() {
    return (
      <div className="container">
        <FlatList
          data={usersData}
          itemKey="id"
          autoLoad / loadOnScroll
          scrollParent={"[data-scroll-parent]"}
          isTabular //---------- true if ListItem is a row of table ---------------//
          positonToScroll="2" //----------- To scroll to a particular List Item index -------//
          batchCount={100}
          renderItem={this.renderItem}
        />
      </div>
    );
  }
}

React Dependency

lodash.isequal: "^4.5.0"

Versions required

node version : >=10 react: "^16.0.0"

Contributors ✨

Bhoomika Gupta

Gash