useBoolean
Hook provides opportunity to manage boolean state
state
necessary
test coverage
Last changed: 6 months ago
Installation
Library
CLI
Manual
typescript
import { useBoolean } from '@siberiacancode/reactuse';Usage
typescript
## Demo const [on, toggle] = useBoolean()Api
Parameters
| Name | Type | Default | Note |
|---|---|---|---|
| initialValue? | boolean | false | The initial boolean value |
Returns
UseBooleanReturn
Type declaration
typescript
export type UseBooleanReturn = [
/** The current boolean state value */
value: boolean,
/** Function to toggle the boolean state */
toggle: (value?: boolean) => void
];Source
Source • DemoContributors
D
B