/handy-hooks

Primary LanguageTypeScriptMIT LicenseMIT

react-fancy-hook

Its a collection of handy react custom hooks


useInitialMount

useInitialMount- returns whether or not the component is mounted. Useful for async effect that may return after the component has been unmounted.

const veryFirstRender=useInitialMount();
    //veryFirstRender = > true in the very first render
    //veryFirstRender = > false in the next renders 

useUniqueID
useUniqueID- returns a unique ID that remains constant across component renders. Great for auto-generating IDs for DOM elements.

const ID= useUniqueID()

usePrevious usePrevious-returns the previous value of a prop or state.

const previousValue=usePrevious()