lbry-desktop/ui/effects/use-previous.js
2019-11-11 13:27:29 -05:00

11 lines
199 B
JavaScript

import { useEffect, useRef } from 'react';
export default function usePrevious(value) {
const ref = useRef();
useEffect(() => {
ref.current = value;
}, [value]);
return ref.current;
}