useUpdateBreakpointEffect

useUpdateBreakpointEffect is a custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes.

The current device is "unknown"

Usage

import { useUpdateBreakpointEffect } from "@yamada-ui/react"
const [device, setDevice] = useState("unknown")

useUpdateBreakpointEffect((breakpoint) => {
  if (breakpoint === "sm") {
    setDevice("mobile")
  } else if (breakpoint === "md") {
    setDevice("tablet")
  } else {
    setDevice("desktop")
  }
}, [])
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd
2nd