ant-design/components/typography/hooks/usePrevious.ts

12 lines
230 B
TypeScript
Raw Normal View History

import { useRef, useEffect } from 'react';
const usePrevious = <T>(value: T): T | undefined => {
const ref = useRef<T>();
useEffect(() => {
ref.current = value;
});
return ref.current;
};
export default usePrevious;