@calvein/use-toggle
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@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>
  );
}

Readme

Keywords

Package Sidebar

Install

npm i @calvein/use-toggle

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

2.95 kB

Total Files

6

Last publish

Collaborators

  • calvein