safak / react-estate-ui

289 stars 932 forks source link

navbar #8

Closed Qurbonov closed 6 months ago

Qurbonov commented 6 months ago

responsive navbar is visibile when normal size ?

Screenshot 2024-04-21 180419

I need your help

ramakrishnan-21 commented 4 months ago

What you can do is add the following lines

const [open, setOpen] = useState(false);
    useEffect(() => {
        const handleResize = () => {
            if (window.innerWidth >= 768) { 
                setOpen(false);
            }
        };

        window.addEventListener('resize', handleResize);
        return () => window.removeEventListener('resize', handleResize);
    }, []);
Basically on resize we have listener which will make setOpen as false and hence navbar will be hidden