React Hooks Pro is a package that is having custom hooks for reactjs
npm install react-hook-collectionsbash
npm i react-hook-collections
Hooks
UseScrollPosition()
This hook tracks the current scroll position of the window and returns the value as a number.
Example usage:
import { UseScrollPosition } from 'react-hook-collections';
function MyComponent() {
const scrollPosition = UseScrollPosition();
console.log(scrollPosition); // Prints the scroll position on the console
return (
My Component
);
}
GetAndDecode()
This hook help you to decode a jwt token from localStorage.
Example usage:
import {GetAndDecode} from 'react-hook-collections';
function MyComponent(){
const decoded = GetAndDecode("tokenkey"); // pass the token key name
console.log(decode); // prints the token decoded information
return (
My Component
)
}
``