mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-30 10:36:35 +02:00
15 lines
372 B
TypeScript
15 lines
372 B
TypeScript
import shim from '../shim';
|
|
|
|
const { useRef, useEffect } = shim.react();
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
|
const usePrevious = (value: any, initialValue: any = null) => {
|
|
const ref = useRef(initialValue);
|
|
useEffect(() => {
|
|
ref.current = value;
|
|
});
|
|
return ref.current;
|
|
};
|
|
|
|
export default usePrevious;
|