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