1.0.0 • Published 6 years ago
@calvein/use-toggle v1.0.0
@calvein/use-toggle
React hook for toggling
Install
npm install @calvein/use-toggle
Usage
import useToggle from '@calvein/use-toggle';
const MyComponent = () => {
const { isOn, isOff, on, off, toggle } = useToggle();
return (
<button onClick={toggle}>
is {isOn ? 'on' : 'off'}
</button>
);
}
1.0.0
6 years ago