import { useEffect } from 'react' ; export const useWindowResizeListener = ( callback ) => { useEffect ( ( ) => { window . addEventListener ( 'resize' , callback ) ; return ( ) => { window . removeEventListener ( 'resize' , callback ) ; } ; } , [ callback ] ) ; } ;