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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-reuse-hooks

v3.0.0

Published

A collection of 30+ production-ready reusable React hooks for web apps, covering state, effects, media, forms, and utilities.

Readme

⚛️ react-reuse-hooks

A lightweight and powerful collection of 28+ reusable custom React hooks to supercharge your development. Simplify your logic for state management, side effects, performance optimizations, form handling, storage, and more — all in one compact package.

Created with ❤️ by Rahul Chaurasia


📦 Installation

npm install react-reuse-hooks
# or
yarn add react-reuse-hooks

📚 Hook Usage Summary Table

| Hook | Description | Example Usage | | ---------------------- | ------------------------------ | ---------------------------------------------------------------- | | useLocalStorage | Sync state with localStorage | const [value, setValue] = useLocalStorage('key', 'default') | | useDebounce | Debounce a value | const debounced = useDebounce(inputValue, 500) | | useToggle | Toggle a boolean | const [isOn, toggle] = useToggle(false) | | useClickOutside | Detect outside clicks | useClickOutside(ref, () => alert('Clicked outside!')) | | useThrottle | Throttle a value update | const throttled = useThrottle(inputValue, 300) | | usePrevious | Get previous value | const prev = usePrevious(value) | | useTimeout | Run function after delay | useTimeout(() => alert('Hello'), 1000) | | useUpdateEffect | Effect only on update | useUpdateEffect(() => {}, [count]) | | useHover | Detect hover | const [ref, hovered] = useHover() | | useOnlineStatus | Track online status | const online = useOnlineStatus() | | useCopyToClipboard | Copy text to clipboard | const [copied, copy] = useCopyToClipboard() | | useClipboard | Also allows clipboard copying | const [copied, setClipboard] = useClipboard() | | useDarkMode | Toggle dark mode | const [darkMode, toggleDarkMode] = useDarkMode() | | useScrollPosition | Get scroll position | const pos = useScrollPosition() | | useWindowSize | Get window size | const { width, height } = useWindowSize() | | useEventListener | Add event listener | useEventListener('resize', handleResize) | | useOnScreen | Detect element visibility | const visible = useOnScreen(ref) | | useWhyDidYouUpdate | Debug re-renders | useWhyDidYouUpdate('MyComponent', props) | | useFocus | Handle focus state | const [ref, focused] = useFocus() | | useGeolocation | Get geolocation | const { latitude, longitude } = useGeolocation() | | useElementSize | Get element dimensions | const [ref, size] = useElementSize() | | useDeviceOrientation | Get device orientation data | const { alpha, beta, gamma } = useDeviceOrientation() | | useForceUpdate | Force re-render | const forceUpdate = useForceUpdate() | | useInput | Manage input field logic | const { value, onChange, reset } = useInput() | | useStateWithCallback | State with callback on update | const [count, setCount] = useStateWithCallback(0, cb) | | useSessionStorage | Use session storage like state | const [data, setData] = useSessionStorage('key', initialValue) | | useKeyPress | Detect specific key press | const isEnter = useKeyPress('Enter') | | useCookie | Manage browser cookies | const [cookie, setCookie] = useCookie('user') |

📚 My Bestselling Tech Books on Amazon Kindle

Supercharge your React and JavaScript knowledge with these practical, interview-focused books by Rahul Chaurasia. 🚀 600+ developers have already leveled up their skills — now it's your turn!

📘 React JS Machine Coding Projects

Build 30 real-world React components asked in interviews — from star ratings to quiz apps.

📗 Redux & Redux Toolkit With React

Master Redux and Redux Toolkit with practical, scalable React patterns.

📙 JavaScript Interview Mastery

Ace any JS interview with this ultimate guide covering 100+ theory questions.

📕 Top 50 Most Asked JavaScript Coding Questions in Interviews

Practice must-know logic questions (arrays, strings, promises, objects).

📒 Mastering ES6

Deep dive into essential ES6 concepts every developer should master.

⭐ These books are beginner-friendly, interview-validated, and written in a simple, clear language. Perfect for self-paced learners and job seekers.


🌟 Contributions Welcome

Have an idea for a new hook or an improvement? Feel free to open a pull request or raise an issue.


📜 License

MIT © 2025 Rahul Chaurasia