@vorlefan/react-hooks
*Useful react hooks for React & Next.js app*
Install
npm install --save @vorlefan/react-hooks
yarn add @vorlefan/react-hooks
Usage
Ir covers up a range of case. Take a look at the list of hooks and some uses of each one.
useAsync
- Handle with async functions at easy
- If you want to handle with heavy functions or methods that requires a time to be working well
useBoolean
- Better way and with a nice semantic to handle Boolean states
useClient
- Only useful if you are handling with apps that it's Server-Side as Next.js.
useDebounce
- For functions that the user can call any time
useFetch
- Hook to do requests on API with a complete suit of options as well handling each state of a 'call'.
useIndex
- With this you can handle with 'Pagination' or whatever use the concept of 'Page Index', 'Per Page'
useLocalStorage
- Save values it and get the values on LocalStorage
useMiddleMouse
- Identify if the user is using the MiddleMouse (scrolling)
useMouseOut
- Identify if the mouse cursor is out of the range of the element
useMouseIn
- Identify if the mosue cursor is inside of the range of the element
useObject
- Complete suit to handle with Object elements.
useScreenSize
- Identify the size of the Window and the orientation of the screen.
useScroll
- Identify the state of the scroll of the page
useToggle
- Useful to handle with Toggle elements like 'Tabs' and so on.
Documentation
Every hooks has their documentation under the folder 'docs' of this repository.
I recommend to look at the 'example' project on 'example' folder of this repository. To install it, just clone the folder and run up:
npm install & npm run build & npm run start
License
MIT © DaxSoft
This hook is created using create-react-hook.