lbry-desktop/ui/effects/use-previous.js

12 lines
199 B
JavaScript
Raw Normal View History

2019-08-14 05:04:08 +02:00
import { useEffect, useRef } from 'react';
export default function usePrevious(value) {
const ref = useRef();
useEffect(() => {
ref.current = value;
}, [value]);
return ref.current;
}