use-boolean-state
v1.0.2
Published
React hook providing functions for boolean state handling
Downloads
203
Maintainers
Readme
use-boolean-state
React hook providing functions for boolean state management
Install
yarn add use-boolean-state
or if you use npm
npm install --save use-boolean-state
Usage
import React from 'react'
import useBooleanState from 'use-boolean-state'
const Example = () => {
const [showing, show, close, toggle] = useBooleanState(false)
return (
<div>
<button onClick={show}>Show</button>
<button onClick={close}>Close</button>
<button onClick={toggle}>Toggle</button>
{showing && <div>Meow</div>}
</div>
)
}
License
MIT © Toleckk
This hook is created using create-react-hook.