Leave Yamada UI a star

Star
Yamada UIYamada UIv1.6.4

useBreakpointState

useBreakpointState is a custom hook that takes a responsive object as an initial state and returns a state corresponding to the current breakpoint.

Source@yamada-ui/use-breakpoint

Import

import { useBreakpointState } from "@yamada-ui/react"
Copied!

Usage

Editable example

const [value, setValue] = useBreakpointState({
  base: 1,
  md: 2,
  sm: 3,
})

return (
  <Button onClick={() => setValue((prev) => prev + 1)}>
    The current value is "{value}"
  </Button>
)
Copied!

Edit this page on GitHub

PrevioususeBreakpointEffectNextuseBreakpointValue