ucs
v1.0.1
Published
another controlled state hook
Downloads
192
Readme
ucs
another controlled state hook
Install
npm install ucs
Usage
import React from "react";
import useControlledState from "ucs";
const Toggler = ({ value, onChange, defaultValue }) => {
const [state, setState] = useControlledState(() => value || defaultValue);
return (
<button onClick={() => setState(!state)}>{state ? "on" : "off"}</button>
);
};
License
MIT © jeetiss