DEV Community

Shubhra Agarwal
Shubhra Agarwal

Posted on

NPM packages for custom hooks that you wouldn't wanna miss out on

Saloni : Hello, Shubh. Hooks have always been handy for me in react. They've made my job a lot easier. I wish React had more hooks than just useState, useEffect

Shubh : You can create your own custom hooks in react and there are some awesome custom hooks on NPM as well.

Let me tell you more about such hooks 🧵

The first one is use-clippy

useClippy is a TypeScript-friendly React hook for reading from and writing to the user's clipboard.

https://www.npmjs.com/package/use-clippy

Second in this list is useScript

It loads a third party script and returns a value when it's loaded or fails to load.

https://www.npmjs.com/package/use-script

Third is react-use-idb (useIdb)

It is a react side-effect hook that manages a single indexDB item.

It's a drop-in replacement over useLocalStorage.

https://www.npmjs.com/package/react-use-idb

The fourth is my personal favourite and it is use-dark-mode

It's a custom React Hook which helps you implement a "dark mode" component for your application. The user setting persists to localStorage.

https://www.npmjs.com/package/react-use-idb

The last one is useDocumentTitle

React Hook (using useEffect()) to set your document title.

https://www.npmjs.com/package/use-document-title

You can look for more custom react hooks on this website

https://reacthooks.org/

I hope I was able to help you out Saloni.

Saloni : Yes!! Thank you so much for telling me about it. I'm going to give you a like and a follow too!!

Discussion (0)