import { useEffect } from 'react';

export const useWindowResize = (onWindowResize: (resized: boolean) => any) => {
    useEffect(() => {
        const onResize = () => {
            onWindowResize && onWindowResize(true);
        };

        window.addEventListener('resize', onResize);

        return () => {
            window.removeEventListener('resize', onResize);
        };
    }, []);

    return null;
};
