Appearance
useBoolean
管理 boolean 状态的 Hook。
Demo
</>
false
Usage
import { useBoolean } from 'v3-use'
const [state, { toggle, setFalse, setTrue }] = useBoolean()
import { useBoolean } from 'v3-use'
const [state, { toggle, setFalse, setTrue }] = useBoolean()
Reference
const [state, actions] = useBoolean(defaultValue?: boolean)
const [state, actions] = useBoolean(defaultValue?: boolean)
Type Declarations
export interface Actions {
toggle: () => void
setTrue: () => void
setFalse: () => void
}
export declare function useBoolean(
defaultValue?: boolean
): [Ref<boolean>, Actions]
export interface Actions {
toggle: () => void
setTrue: () => void
setFalse: () => void
}
export declare function useBoolean(
defaultValue?: boolean
): [Ref<boolean>, Actions]