RJS Hook Library
Some (almost all) hooks has been copied from internet foruns. If necessary look from source info to check who created the hook.
How to maintain
- Clone
- NVM use 16.14.2 (node 16.14.2 / npm 8.5.0)
- npm i
- make changes
- git add / git commit / git push
- npm run publish (custom command)
Hooks
- useElementSize (Get element sizes using ref)
- useHover (control when a element is hovererd using ref)
- useOnClickOutside (Listen when clicked outside component using ref)
- usePersistedState (An option to persist state in local storage)
- usePrevious (Keep state value between current and previous render)
- useWindowSize (Get window sizes)
- useTimer (a count down minute / seconds)
- useClickOutside (An event handler to trigger an action by outside-click-element using ref)
- useOnPressKey (An event handler to trigger an action by key press using ref)
Use
import {useElementSize} from '@gadeoli/rjs-hooks-library';
Sources
useElementSize
useOnClickOutside
usePersistedState
usePrevious
useTimer
useWindowSize
useClickOutside
useOnPressKey