github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/hooks/usePrevious.ts (about) 1 import { useEffect, useRef } from "react"; 2 3 function usePrevious<T>(value: T): T { 4 const ref: any = useRef<T>(); 5 useEffect(() => { 6 ref.current = value; 7 }, [value]); 8 return ref.current; 9 } 10 11 export default usePrevious;