laconic-wallet/hooks/usePrevious.ts
Adwait Gharpure 8bd3b4b567
Handle all dapps getting updated on adding accounts (#55)
* Replace QR icon with WC logo

* Change screen title

* Change title

* Display session topic in list item

* Move useEffect to WalletConnectContext

* Disconnect sessions on resetting wallet

* Update dapp session on adding account

* Update sessions inside useEffect

* Clean up code

* Remove question mark

* Handle all dapps getting updated

* Remove index from map

* Move hook to different folder

---------

Co-authored-by: Adw8 <adwait@deepstacksoft.com>
2024-03-14 13:53:04 +05:30

10 lines
215 B
TypeScript

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