npm.io
2.1.1 • Published 5 years ago

@billogram/use-toggle

Licence
MIT
Version
2.1.1
Deps
2
Size
21 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

@billogram/use-toggle

A React hook for toggle components

Install

yarn add @billogram/use-toggle

Usage

import useToggle from '@billogram/use-toggle';

See types for exported types.

useToggle
const {
    close,
    open,
    toggle,
    value,
} = useToggle({
    disabled: false,
    initialValue: false,
    onOff: noop,
    onOn: noop,
    shouldRunHandlerOnInitialRender: false,
});

Note

This library is being published with our use cases in mind and is not necessarily meant to be consumed by the broader public. We probably won't take your feature requests unless they align with our own needs.

License

MIT