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

hooks-library-react

v1.2.0

Published

Different react hooks

Readme

hooks-library-react

Package

npm i hooks-library-react

useDataFetch

The useDataFetch hook allows you to fetch data from a given URL and manage the loading and error states effectively. It is ideal for simple data fetching in functional components. Usage

const { data, loading, error } = useDataFetch('https://api.example.com/data');
  • Parameters: url (String): The URL to fetch data from.

-Returns: data: The fetched data (initially null). loading: A boolean indicating if the data is currently being loaded. error: An error object if an error occurs during the fetching process.


useDebounce

The useDebounce hook delays the update of a value until after a specified delay, which is useful for reducing the number of API calls or re-renders, especially when dealing with input fields or search bars. Usage:

const debouncedValue = useDebounce(value, delay);
  • Parameters: value (Any): The value to debounce. delay (Number): The delay in milliseconds before updating the debounced value.

  • Returns: debouncedValue: The debounced value, which only updates after the specified delay.


useLocalStorage

The useLocalStorage hook allows you to manage and persist state in localStorage, which is useful for storing user preferences, session data, or other values that need to be persistent even after page refreshes. Usage:

const [storedValue, setStoredValue] = useLocalStorage('key', 'initialValue');
  • Parameters: key (String): The key used to store the value in localStorage. initialValue (Any): The initial value if nothing is stored in localStorage.

  • Returns: storedValue: The value retrieved from localStorage. setStoredValue: A function to update and store a new value in localStorage.


usePrevious

The usePrevious hook stores the previous value of a state or prop, which can be useful for tracking changes or making comparisons over time. Usage:

const previousValue = usePrevious(value);
  • Parameters: value (Any): The current value whose previous state needs to be tracked.

  • Returns: previousValue: The value before the last update. value (Any): The current value whose previous state needs to be tracked.