Custom hook to track and respond to viewport breakpoint changes. Provides responsive design information based on window width.
An object containing:
// Basic usageconst { isMobile, current } = useBreakpoint();if (isMobile) { // Render mobile component} Copy
// Basic usageconst { isMobile, current } = useBreakpoint();if (isMobile) { // Render mobile component}
// Conditional renderingconst { current } = useBreakpoint();return ( <div> {current === 'mobile' ? <MobileView /> : <DesktopView />} </div>); Copy
// Conditional renderingconst { current } = useBreakpoint();return ( <div> {current === 'mobile' ? <MobileView /> : <DesktopView />} </div>);
Custom hook to track and respond to viewport breakpoint changes. Provides responsive design information based on window width.