• Stars
    star
    2,872
  • Rank 15,792 (Top 0.4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Essential React custom hooks βš“ to super charge your components!



CI and Semantic Release GitHub GitHub release (latest by date) GitHub contributors npm npm bundle size Codecov branch node-lts Website Module




Essential React custom hooks βš“ to super charge your components!



List of all hooks

πŸ”₯ Effects

πŸš€ Events

πŸ“ Form

✨ Misc

πŸšƒ Navigator

❇️ State

  • useArrayState - Array state manager hook for React
  • useCountdown - Count down to a target timestamp and call callbacks every second (or provided peried)
  • useCounter - Counter hook for React.
  • useGetIsMounted - Checks if a component is mounted or not at the time. Useful for async effects
  • useLocalstorageState - UseState but auto updates values to localStorage
  • useMapState - A react hook to manage state in a key value pair map.
  • useMultiSelectableList - A custom hook to easily select multiple values from a list
  • useNativeMapState - Manage Map() object state in React
  • usePreviousDifferent - usePreviousDifferent returns the last different value of a variable
  • usePreviousImmediate - usePreviousImmediate returns the previous value of a variable even if it was the same or different
  • usePromise - Promise management hook for react
  • useQueueState - A React hook that manages state in the form of a queue
  • useSafeSetState - set state but ignores if component has already unmounted
  • useSelect - Select values from a list easily. List selection hook for react.
  • useSelectableList - Easily select a single value from a list of values. very useful for radio buttons, select inputs etc.
  • useSessionstorageState - useState but syncs with sessionstorage
  • useSetState - Manage the state of a Set in React.
  • useStackState - A React hook that manages state in the form of a stack
  • useTimeTravelState - A hook that manages state which can undo and redo. A more powerful version of useUndoState hook.
  • useUndoRedoState - Setstate but can also undo and redo
  • useUndoState - Drop in replacement for useState hook but with undo functionality.

βš›οΈ UI

  • useAudio - Audio hook
  • useBoundingclientrect - getBoundingClientRect hook for React.
  • useBoundingclientrectRef - A hook that tracks the boundingclientrect of an element. It returns a callbackRef so that the element node if changed is easily tracked.
  • useFullscreen - Use full screen api for making beautiful and emersive experinces.
  • useGeolocation - A hook to provide the geolocation info on client side.
  • useInViewRef - Simple hook that monitors element enters or leave the viewport that's using Intersection Observer API.
  • useIntersectionObserverRef - A hook to register an intersection observer listener.
  • useKey - keypress, keyup and keydown event handlers as hooks for react.
  • useKeyBindings - useKeyBindings can bind multiple keys to multiple callbacks and fire the callbacks on key press.
  • useKeyRef - Very similar useKey but it returns a ref
  • useKeys - A hook which allows to setup callbacks when a combination of keys are pressed at the same time.
  • useMediaMatch - Signal whether or not a media query is currently matched.
  • useMouse - Mouse position hook for React.
  • useMutationObserver - Mutation Observer hook for React.
  • useMutationObserverRef - A hook that tracks mutations of an element. It returns a callbackRef.
  • useRaf - A continuously running requestAnimationFrame hook for React
  • useResizeObserverRef - Resize Observer hook for React.
  • useVideo - Video hook for react
  • useWindowScrollPosition - A React hook to get the scroll position of the window
  • useWindowSize - Window size hook for React.


Features

βœ… Collection of 91 hooks as standalone modules.

βœ… Standalone package with all the hooks at one place

βœ… CommonJS, UMD and ESM Support

Installation

npm i -s rooks

Import any hook from "rooks" and start using them!

import { useDidMount } from "rooks";

Usage

function App() {
  useDidMount(() => {
    alert("mounted");
  });
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
    </div>
  );
}

Standalone Package

Package containing all the hooks is over here. - Docs and Npm Install


License

MIT

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):

Bhargav Ponnapalli
Bhargav Ponnapalli

πŸ’» 🚧
anil kumar chaudhary
anil kumar chaudhary

πŸ’»
Qiwei Yang
Qiwei Yang

πŸ’» 🚧
maciek_grzybek
maciek_grzybek

πŸ’»
Harsh Zalavadiya
Harsh Zalavadiya

πŸ’»
B V K MAHIJENDRA
B V K MAHIJENDRA

πŸ’»
Braxton Christensen
Braxton Christensen

πŸ’»
Hansel
Hansel

πŸ’»
Harshil Parmar
Harshil Parmar

πŸ’»
Lionel
Lionel

πŸ’»
Max Stoiber
Max Stoiber

πŸ’»
Michael Moore
Michael Moore

πŸ’»
Rajas Paranjpe
Rajas Paranjpe

πŸ’»
Mahendra Choudhary
Mahendra Choudhary

πŸ’»
Nghia Pham
Nghia Pham

πŸ’»
Akshay Kadam (A2K)
Akshay Kadam (A2K)

πŸ’»
Alex Golubtsov
Alex Golubtsov

πŸ’»
Arman
Arman

πŸ’»
Branden Visser
Branden Visser

πŸ’»
Brian Steere
Brian Steere

πŸ’»
Cal Courtney
Cal Courtney

πŸ’»
Chris Milson
Chris Milson

πŸ’»
Cong Zhang
Cong Zhang

πŸ’»
Daniel Holmes
Daniel Holmes

πŸ’»
Fernando Beck
Fernando Beck

πŸ’»
Josh Davenport
Josh Davenport

πŸ’»
MARCEL
MARCEL

πŸ’»
Neilor Caldeira
Neilor Caldeira

πŸ’»
Tobias Lins
Tobias Lins

πŸ’»
Tsvetan
Tsvetan

πŸ’»
Wei Zhu
Wei Zhu

πŸ’»
Yakko Majuri
Yakko Majuri

πŸ’»
Frank Hellwig
Frank Hellwig

πŸ’»
Austin Peterson
Austin Peterson

πŸ’»
thodubois
thodubois

πŸ’»
wes christiansen
wes christiansen

πŸ’»
CJ Patoilo
CJ Patoilo

πŸ’»
mar1u50
mar1u50

πŸ’»
Ayushman Gupta
Ayushman Gupta

πŸ’»
Rafael Ferreira
Rafael Ferreira

πŸ’»
Kristinn Thor Johannsson
Kristinn Thor Johannsson

πŸ’»
Michael Moore
Michael Moore

πŸ’»
Trevor Blades
Trevor Blades

πŸ’»
official_dulin
official_dulin

πŸ’»
Billy Mosis Priambodo
Billy Mosis Priambodo

πŸ’»
Stafford Williams
Stafford Williams

πŸ’»
Chanhee Kim
Chanhee Kim

πŸ’»
Hooriza
Hooriza

πŸ’»
Nils Wittler
Nils Wittler

πŸ’»
Sebastian SzczepaΕ„ski
Sebastian SzczepaΕ„ski

πŸ’»
Mahendra Choudhary
Mahendra Choudhary

πŸ’»
Som Shekhar Mukherjee
Som Shekhar Mukherjee

πŸ’»
Qiushi Pan
Qiushi Pan

πŸ’»
Jishnu Viswanath
Jishnu Viswanath

πŸ’»
brahambence
brahambence

πŸ’»
dependabot[bot]
dependabot[bot]

πŸ’»
renovate[bot]
renovate[bot]

πŸ’»
dependabot-preview[bot]
dependabot-preview[bot]

πŸ’»
github-actions[bot]
github-actions[bot]

πŸ’»
allcontributors[bot]
allcontributors[bot]

πŸ’»
zhangenming
zhangenming

πŸ’»
Antoni Kiszka
Antoni Kiszka

πŸ’»
Greg Poole
Greg Poole

πŸ’»
mergify[bot]
mergify[bot]

πŸ’»
Chaitanya J
Chaitanya J

πŸ’»
G H Mahimaanvita
G H Mahimaanvita

πŸ’»
Danilo Woznica
Danilo Woznica

πŸ’»
dan-klasson
dan-klasson

πŸ’»
SΓ©bastien Vanvelthem
SΓ©bastien Vanvelthem

πŸ’»
Aleksandr Soldatov
Aleksandr Soldatov

πŸ’»
Eli Yukelzon
Eli Yukelzon

πŸ’»
Mahendra Choudhary
Mahendra Choudhary

πŸ’»
Chaitanya J
Chaitanya J

πŸ’»
Dominik Dorfmeister
Dominik Dorfmeister

πŸ’»
Nghiệp
Nghiệp

πŸ’»
Seongmin Park
Seongmin Park

πŸ’»
Nate Higgins
Nate Higgins

πŸ’»

Other hooks libraries

These are some libraries that I constantly take inspiration and ideas from

  1. React-use
  2. React-aria
  3. Valtio
  4. Jotai
  5. Recoil
  6. Downshiftjs
  7. React hook form

More Repositories

1

nextbase-nextjs-supabase-starter

πŸš€βš‘οΈ Free Boilerplate and Starter kit for Next.js 14+, Supabase, Tailwind CSS 3.2 and TypeScript. πŸš€ Next.js πŸ”₯ Supabase πŸ’» TypeScript πŸ’š ESLint 🎨 Prettier 🐢 Husky 🧹 Lint-Staged πŸ§ͺ Jest πŸ§ͺ Testing Library πŸ•ΉοΈ Playwright ✍️ Commitizen πŸ’¬ Commitlint πŸ’» VSCode πŸŒͺ️ Vercel 🎨 PostCSS πŸƒ Tailwind CSS βš›οΈ React Query
TypeScript
544
star
2

react-lazy-progressive-image

React Progressive images with Lazy loading ⚑
JavaScript
46
star
3

react-universal-starter

React@16, react-router@4, redux and webpack@4 starter project
JavaScript
45
star
4

armin

Declarative state machines for React!
JavaScript
20
star
5

rehooks-visibility-sensor

Checks whether a Ref has scrolled into view or not.
JavaScript
13
star
6

dictionary-offline

A simple project that uses Service Workers and PouchDB for an offline experience.
JavaScript
10
star
7

clickable-npm-scripts

Execute npm scripts on one click in atom
JavaScript
9
star
8

puppeteer-pdf-action

A Github Action to create a PDF out of a website URL. Useful to generate resumes out of portfolio websites.
JavaScript
6
star
9

nextjs-bounty-submission

TypeScript
5
star
10

useful-css-resources

3
star
11

fizzbuzz

Fizz Buzz in Javascript
3
star
12

noop

A no operation package with go.
Go
3
star
13

react-scroll-sensor

Get the scroll positions of the window object in your component
JavaScript
3
star
14

generator-react-babel

Create react plugins seamlessly!
JavaScript
3
star
15

codementor-officehours

A simple TDD React App
JavaScript
3
star
16

react-layouts

React UI Layout Library
JavaScript
3
star
17

nextbase-nuxt-supabase-starter

πŸš€βš‘οΈ Free Boilerplate and Starter kit for Nuxt 3+, Supabase, Tailwind CSS 3+ and TypeScript. πŸš€ Nuxt.js Vue.js πŸ”₯ Supabase πŸ’» TypeScript πŸ’š ESLint 🎨 Prettier πŸ’» VSCode πŸŒͺ️ Vercel 🎨 PostCSS πŸƒ Tailwind CSS
Vue
3
star
18

imbhargav5

Hi!
Mustache
2
star
19

fetch-unless-cached

Store fetch responses in localStorage with expire timers! And fetch when idle and update cache in the background
JavaScript
2
star
20

awesome-icon-libraries

2
star
21

react-password-generator

ReactJS powered password generator
JavaScript
2
star
22

redux-awesome-modal

JavaScript
2
star
23

react-pong

Pong game in React
JavaScript
2
star
24

react-select-dropdown

Demo
JavaScript
2
star
25

working_on

Stuff to learn
1
star
26

fbs-net

Gatsby starter for a Contentful project from the community.
JavaScript
1
star
27

eren-light-syntax

Light syntax theme for atom
CSS
1
star
28

timezone-compare

Helps people who do mentorship @codementor or other sites. Cli tool to get a list of times across 2 different timezones for easy checking.
JavaScript
1
star
29

trello-promise

JavaScript
1
star
30

hashnode-user-with-posts-json

JavaScript
1
star
31

mergesort-with-generators

Merge sort using generators
JavaScript
1
star
32

pokedex

JavaScript
1
star
33

learn-react

JavaScript
1
star