useBoolean ​
Hook provides opportunity to manage boolean state
utilities
test coverage
Last changed: 7 days ago
Installation ​
Library
CLI
Manual
typescript
import { useBoolean } from '@siberiacancode/reactuse';
Usage ​
typescript
const [on, toggle] = useBoolean()
Demo ​
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 ​
B
D