@trashpanda001/helpers
    Preparing search index...

    Function useViewport

    • Returns the current viewport's size as width and height in CSS pixels and breakpoint booleans.

      This hook listens for window resize events. Using useIsMobile or useMediaQuery when checking breakpoints is recommended for performance reasons, as they only fire out boundary changes.

      Returns ViewportInfo

      viewport details

      Get viewport dimensions on resize.

      import { useViewport } from "@trashpanda001/helpers/react"

      function Component() {
      const { width, height } = useViewport()
      return <div>Width: {width}, Height: {height}</div>
      }