--- title: useUpdateBreakpointEffect description: "`useUpdateBreakpointEffect` is a custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-breakpoint - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useupdatebreakpointeffect--basic --- ```tsx const [device, setDevice] = useState("unknown"); useUpdateBreakpointEffect(breakpoint => { if (breakpoint === "sm") { setDevice("mobile"); } else if (breakpoint === "md") { setDevice("tablet"); } else { setDevice("desktop"); } }, []); return The current device is "{device}"; ``` ## Usage ```tsx import { useUpdateBreakpointEffect } from "@yamada-ui/react" ``` ```tsx import { useUpdateBreakpointEffect } from "@/components/ui" ``` ```tsx import { useUpdateBreakpointEffect } from "@workspaces/ui" ``` ```tsx const [device, setDevice] = useState("unknown") useUpdateBreakpointEffect((breakpoint) => { if (breakpoint === "sm") { setDevice("mobile") } else if (breakpoint === "md") { setDevice("tablet") } else { setDevice("desktop") } }, []) ```