Files
twenty/packages/twenty-front/src/hooks/useUpdateEffect.ts
T
Félix Malfait 464a480043 Continue ESLINT9 Migration (#13795)
Might already fix #13793
2025-08-10 23:25:58 +02:00

18 lines
414 B
TypeScript

import { type DependencyList, type EffectCallback, useEffect } from 'react';
import { useFirstMountState } from './useFirstMountState';
export const useUpdateEffect = (
effect: EffectCallback,
deps?: DependencyList,
) => {
const isFirst = useFirstMountState();
useEffect(() => {
if (!isFirst) {
return effect();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
};