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-hooks-bank

v1.1.0

Published

A collection of **powerful, reusable custom React hooks** for complex, non-trivial interactions that go beyond React’s native features.

Downloads

8

Readme

🖖 react-hooks-bank

A collection of powerful, reusable custom React hooks for complex, non-trivial interactions that go beyond React’s native features.

Built with performance and developer ergonomics in mind, these hooks help you accelerate development and build more interactive experiences effortlessly.


🚀 Features

  • 🌐 Fully typed with TypeScript
  • 🧠 Designed for advanced and non-standard use cases
  • 🧹 Pluggable and composable React hooks
  • 🔧 Minimal dependencies, lightweight and tree-shakable
  • 🔓 Open-source and community-driven

🖖 Installation

npm install react-hooks-bank

Or using yarn:

yarn add react-hooks-bank

🧹 Usage Example (General)

Import the hooks you need and use them in your components:

import { useInfiniteScroll } from "react-hooks-bank";

const MyComponent = () => {
  const isLoading = useInfiniteScroll(() => {
    // Callback when scroll reaches threshold
    fetchMoreItems();
  });

  return (
    <div>
      {/* Your list rendering */}
      {isLoading && <p>Loading more...</p>}
    </div>
  );
};

🔹 Available Hooks

Click a hook to jump to detailed usage instructions:


🧠 How to Use Each Hook

useClickOutside

Purpose: Detect clicks outside a specific DOM element.

How to use:

const ref = useRef(null);
useClickOutside(ref, () => console.log("Clicked outside!"));

Returns: void

Parameters:

  • ref: RefObject<HTMLElement> - Required: Element to monitor
  • callback: () => void - Required: Triggered when clicking outside

useDebouncedValue

Purpose: Return a debounced version of a value.

How to use:

const debouncedValue = useDebouncedValue(searchTerm, 500);

Returns: any – Debounced value

Parameters:

  • value: anyRequired: The value to debounce
  • delay: numberRequired: Delay in ms

useFetch

Purpose: Fetch data with loading and error state.

How to use:

const { data, loading, error } = useFetch('/api/data');

Returns: { data, loading, error }

Parameters:

  • url: stringRequired: Endpoint URL
  • options?: RequestInit – Optional fetch options

useGeolocation

Purpose: Track user's geolocation.

How to use:

const { coords, error } = useGeolocation();

Returns: { coords, error }

Parameters:

  • options?: PositionOptions – Optional navigator geolocation options

useHover

Purpose: Detect hover state on an element.

How to use:

const { ref, hovered } = useHover();

Returns: { ref, hovered }

Parameters: None


useInfiniteScroll

Purpose: Trigger callback when scrolled to bottom threshold.

How to use:

const isLoading = useInfiniteScroll(() => loadMoreItems());

Returns: booleantrue if loading

Parameters:

  • callback: () => voidRequired
  • threshold?: number – Distance in px to bottom (default: 100)

useIntersectionObserver

Purpose: Observe if an element is visible in viewport.

How to use:

const { ref, entry } = useIntersectionObserver();

Returns: { ref, entry }

Parameters:

  • options?: IntersectionObserverInit

useLockBodyScroll

Purpose: Prevent body scroll when active.

How to use:

useLockBodyScroll();

Returns: void

Parameters: None


useNetworkStatus

Purpose: Detect online/offline network status.

How to use:

const isOnline = useNetworkStatus();

Returns: boolean

Parameters: None


useThrottle

Purpose: Throttle a value change over time.

How to use:

const throttled = useThrottle(value, 300);

Returns: any – Throttled value

Parameters:

  • value: anyRequired
  • delay: numberRequired

useDeviceInfo

Purpose: Retrieve device OS, browser, and screen info.

How to use:

const { os, browser, screen } = useDeviceInfo();

Returns: { os, browser, screen }

Parameters: None


useOrientation

Purpose: Track screen orientation and angle.

How to use:

const { angle, type } = useOrientation();

Returns: { angle: number, type: string }

Parameters: None


useCopyToClipboard

Purpose: Simplifies copying text to the user’s clipboard and reporting success/failure.

How to use:

const [ copy, isCopied ] = useCopyToClipboard();

Returns: [ copy: (text: string) => Promise<boolean>, isCopied: boolean ]

Parameters: None


🛠 Local Development

To run the project locally:

git clone https://github.com/mysticwillz/react-hooks-bank.git
cd react-hooks-bank
npm install
npm run build

🤝 Contributing

Contributions are very welcome!

If you'd like to add a new hook, improve documentation, or fix a bug:

  1. Fork the repo
  2. Create a new branch
  3. Submit a PR

Please follow the guidelines in CONTRIBUTING.md.


📃 License

This project is licensed under the MIT License


👤 Author

Built with ❤️ by Eze Williams Ezebuilo


⭐ Support & Collaboration

If this project helps you or you’d like to collaborate, star the repo and share it with other developers!