UNPKG

@airship/rn-components

Version:

React Native components, from basic inputs to animated wrappers, created by Airship to build quality apps.

19 lines (18 loc) 602 B
import React from 'react'; /** * Set a ref to a variable's current value. * This is useful for avoiding re-renders or re-triggers when including * a variable in a useEffect dependency array. * * **USAGE:** * ``` * const currentNumberRef = useCurrent(currentNumber); * // currentNumberRef is always the same Javascript object, * // so this avoids re-triggering the useEffect callback function. * useEffect(() => { * console.log(currentNumberRef.current); * }, [currentNumberRef]); * ``` */ declare const useCurrent: <T>(value: T) => React.MutableRefObject<T>; export default useCurrent;