mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-30 10:36:35 +02:00
10 lines
229 B
TypeScript
10 lines
229 B
TypeScript
|
import { useEffect, useRef } from 'react';
|
||
|
|
||
|
export default function usePrevious(value: any, initialValue:any = null): any {
|
||
|
const ref = useRef(initialValue);
|
||
|
useEffect(() => {
|
||
|
ref.current = value;
|
||
|
});
|
||
|
return ref.current;
|
||
|
}
|