mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-14 16:20:04 +00:00
13 lines
349 B
TypeScript
13 lines
349 B
TypeScript
import {useEffect, useRef} from "react";
|
|
|
|
export default function useUpdateEffect(effect: Function, dependencies?: [any]) {
|
|
const isInitialMount = useRef(true);
|
|
|
|
useEffect(() => {
|
|
if (isInitialMount.current) {
|
|
isInitialMount.current = false;
|
|
} else {
|
|
return effect();
|
|
}
|
|
}, dependencies);
|
|
} |