import { useEffect } from 'react' ; const useWindowLoad = ( func ) => { useEffect ( ( ) => { const onLoad = ( event ) : void => { func ( event ) ; } ; window . addEventListener ( 'load' , onLoad ) ; return ( ) => { window . removeEventListener ( 'load' , onLoad ) ; } ; } , [ ] ) ; } ; export default useWindowLoad ;