UNPKG

react-screen-responsive-hooks

Version:

A simple React hooks kit for handling window size, breakpoints, orientation, and media queries in responsive layouts.

16 lines (15 loc) 355 B
import { useWindowSize } from "./useWindowSize"; export function useBreakpoint() { var width = useWindowSize().width; if (width < 640) return "xs"; if (width < 768) return "sm"; if (width < 1024) return "md"; if (width < 1280) return "lg"; if (width < 1536) return "xl"; return "2xl"; }