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

use-sequential-list

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

use-sequential-list

useSequentialList hooks

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

use-sequential-list is a React hook that allows you to sequentially render a list of items.

Install

npm install use-sequential-list

Usage

import { useSequentialList } from 'use-sequential-list';
import { useEffect } from 'react';

const origin = [
    { name: 'Item 1' },
    { name: 'Item 2' },
    { name: 'Item 3' },
    { name: 'Item 4' },
];


function App() {
    const { items } = useSequentialList(origin);

    return (
        <div>
            {items.map((item) => (
                <Item key={item.name} {...item} />
            ))}
        </div>
    );
}

interface ItemProps {
    name: string;
    done: () => void;
    isLoaded: boolean;
}

function Item({ name, done, isLoaded }: ItemProps) {
    useEffect(() => {
        const timer = setTimeout(() => {
            done();
        }, 1000);

        return () => {
            clearTimeout(timer);
        };
    //NOTE: that we don't need to add `done` to the dependency array
    }, []);

    return (
        <div>
            {name} {isLoaded ? '✔️' : '❌'}
        </div>
    );
}

export default App;

Result

Result

Parameters

NameTypeDescription
itemsT[]The list of items to render sequentially.

Issues

If you find any issues, please report them.

FAQs

Package last updated on 10 Jul 2023

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