All files / app/utilities hooks.ts

1 2 3 4 5 6 7 8 9 10      2x 2x 2x   2x    
import { useRef, useEffect } from 'react';
 
export function usePrevious(value: any) {
  const ref = useRef();
  useEffect(() => {
    ref.current = value;
  });
  return ref.current;
}