A Swiss Army knife or hooks and utilities for your next React project.
Documentation
·
Report Bug
Welcome to React Multitool - a (mainly hooks) utility library for React. It's still very much under construction, but a stable release is on the way. Please don't use this in any production code, and be aware that everything is subject to change at any time before v1.0.0. That said, please test it out, report bugs, suggest features or even contribute to the project.
npm install react-multitool
yarn add react-multitool
React Multitool provides several hooks that I've found myself writing over and over again - click each link to see the documentation for that hook.
useAsync
- manages the lifecycle states of an async function
useClickAway
- detects when clicking outside of an element, useful for modals and dialogues.
useClipboard
- wrapper around the browser clipboard API
useCounter
- a hook that counts up, with utilities such as looping and resetting.
useEvent
- adds and manages event listeners on DOM elements
useHover
- detects when a user's mouse is within a DOM element
useLocalData
- an abstraction on useState
that persists and retrieves data in localStorage
useMouse
- returns the current mouse coordinates relative to the window or a DOM element
useOpen
- a wrapper around useState
for handling modals and other open-close design patterns.
usePrevious
- holds the previous value of a variable
useQueue
- a wrapper around useState
implementing a Queue ADT
useScrollLock
- utility hook to conditionally lock scrolling of the window or a scrollable DOM element.
useSet
- a wrapper around useState
implementing a state ADT
useStack
- a wrapper around useState
implementing a Stack ADT
Coming soon (allegedly)
If you've found something not quite right or something missing, please feel free to open an issue and I'll respond as soon as I can
If you'd like to contribute to React Multitool you're welcome to open a pull request - please note that for a feature to be accepted you'll need to provide tests and documentation! See contributing for more information.
I'm a full-time student, work part time and have several hobbies - React Multitool is provided for free, forever, as a resource that'll hopefully help someone with their next project! If you'd like to support what I do, I'd love for you to share this library around, visit my website or let me know of any interesting opportunities!