forked from github/cinny
(chore) remove outdated code (#1765)
* optimize room typing members hook * remove unused code - WIP * remove old code from initMatrix * remove twemojify function * remove old sanitize util * delete old markdown util * delete Math atom component * uninstall unused dependencies * remove old notification system * decrypt message in inbox notification center and fix refresh in background * improve notification --------- Co-authored-by: Krishan <33421343+kfiven@users.noreply.github.com>
This commit is contained in:
11
src/app/hooks/usePreviousValue.ts
Normal file
11
src/app/hooks/usePreviousValue.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
export const usePreviousValue = <T>(currentValue: T, initialValue: T) => {
|
||||
const valueRef = useRef(initialValue);
|
||||
|
||||
useEffect(() => {
|
||||
valueRef.current = currentValue;
|
||||
}, [currentValue]);
|
||||
|
||||
return valueRef.current;
|
||||
};
|
||||
Reference in New Issue
Block a user