Uniformize folder structure (#693)
* Uniformize folder structure * Fix icons * Fix icons * Fix tests * Fix tests
This commit is contained in:
14
front/src/hooks/useUpdateEffect.ts
Normal file
14
front/src/hooks/useUpdateEffect.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { DependencyList, EffectCallback, useEffect } from 'react';
|
||||
|
||||
import { useFirstMountState } from './useFirstMountState';
|
||||
|
||||
export function useUpdateEffect(effect: EffectCallback, deps?: DependencyList) {
|
||||
const isFirst = useFirstMountState();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFirst) {
|
||||
return effect();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, deps);
|
||||
}
|
||||
Reference in New Issue
Block a user