import { useEffect , useRef } from 'react' ; param effect param deps see https export function useEffectAfterMount ( effect , deps ? ) { const isMounted = useRef ( false ) ; useEffect ( ( ) => { if ( isMounted . current ) { effect ( ) ; } isMounted . current = true ; } , deps ) ; }