mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-23 12:11:51 +00:00
First version of integrating donatso/family-chart #185
This commit is contained in:
9
src/util/previous-hook.ts
Normal file
9
src/util/previous-hook.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import {useEffect, useRef} from 'react';
|
||||
|
||||
export function usePrevious<T>(value: T): T | undefined {
|
||||
const ref = useRef<T | undefined>(undefined);
|
||||
useEffect(() => {
|
||||
ref.current = value;
|
||||
});
|
||||
return ref.current;
|
||||
}
|
||||
Reference in New Issue
Block a user