Spaces:
Runtime error
Runtime error
File size: 303 Bytes
3b6afc0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { useEffect, useRef } from 'react';
const useDidMountEffect = (func, deps) => {
const didMount = useRef(false);
useEffect(() => {
if (didMount.current) {
func();
} else {
didMount.current = true;
}
return func;
}, deps);
};
export default useDidMountEffect;
|