use-toggl
v0.0.3
Published
React hook for toggling between 2 values rather than boolean
Downloads
13
Maintainers
Readme
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>
);
};