• Stars
    star
    2,872
  • Rank 15,270 (Top 0.4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 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
450
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

useful-css-resources

3
star
10

fizzbuzz

Fizz Buzz in Javascript
3
star
11

noop

A no operation package with go.
Go
3
star
12

react-scroll-sensor

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

generator-react-babel

Create react plugins seamlessly!
JavaScript
3
star
14

codementor-officehours

A simple TDD React App
JavaScript
3
star
15

react-layouts

React UI Layout Library
JavaScript
3
star
16

imbhargav5

Hi!
Mustache
2
star
17

awesome-icon-libraries

2
star
18

react-password-generator

ReactJS powered password generator
JavaScript
2
star
19

react-pong

Pong game in React
JavaScript
2
star
20

redux-awesome-modal

JavaScript
2
star
21

react-select-dropdown

Demo
JavaScript
2
star
22

fetch-unless-cached

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

working_on

Stuff to learn
1
star
24

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
25

fbs-net

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

eren-light-syntax

Light syntax theme for atom
CSS
1
star
27

trello-promise

JavaScript
1
star
28

hashnode-user-with-posts-json

JavaScript
1
star
29

mergesort-with-generators

Merge sort using generators
JavaScript
1
star
30

pokedex

JavaScript
1
star
31

learn-react

JavaScript
1
star