mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
15 lines
325 B
TypeScript
15 lines
325 B
TypeScript
import { useEffect } from 'react';
|
|
import { useFirstMountState } from './useFirstMountState';
|
|
|
|
const useUpdateEffect: typeof useEffect = (effect, deps) => {
|
|
const isFirstMount = useFirstMountState();
|
|
|
|
useEffect(() => {
|
|
if (!isFirstMount) {
|
|
return effect();
|
|
}
|
|
}, deps);
|
|
};
|
|
|
|
export default useUpdateEffect;
|