useBreakpointState
useBreakpointState
is a custom hook that takes a responsive object as an initial state and returns a state corresponding to the current breakpoint.
Import
import { useBreakpointState } from "@yamada-ui/react"
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> )
The keys of the object define the keys set in the theme's breakpoint.
If you want to learn more about responsive styles, please check here.
Edit this page on GitHub