File size: 191 Bytes
1e92f2d
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import { useRef } from 'react';

const useLatest = <T>(value: T): { readonly current: T } => {
  const ref = useRef(value);
  ref.current = value;
  return ref;
};

export default useLatest;