use-toggl
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

use-toggl

Simple React hook to toggle between 2 values like booleans

Install

yarn add use-toggl
npm i use-toggl

Usage

import { useToggl } from "use-toggle";

export const Component = () => {
  const [currentValue, isGood, isBad, toggle] = useToggl(["good", "bad"]);

  return (
    <div>
      <p>Im {value}</p>
      <button>Go to {isGood ? "dark" : "light"} side</button>
    </div>
  );
};

Package Sidebar

Install

npm i use-toggl

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

5.36 kB

Total Files

12

Last publish

Collaborators

  • tsivinsky17