1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/ui/hooks/usePrevious.js

10 lines
189 B
JavaScript
Raw Normal View History

import { useEffect, useRef } from 'react';
2020-10-06 20:28:38 +02:00
2020-11-03 00:41:28 +01:00
export function usePrevious(value) {
const ref = useRef();
2020-10-06 20:28:38 +02:00
useEffect(() => {
ref.current = value;
}, [value]);
return ref.current;
2020-10-06 20:28:38 +02:00
}