A hook that toggle states.
import { useToggle } from '@mints/hooks';
const Example = () => {
const [state, toggle] = useToggle('Hello', 'World');
return (
<div>
<span>{state}</span>
<span onClick={toggle}>Toggle</span>
</div>
);
};
useToggle = <T, U>(
defaultState: T = false as T,
reverseState?: U,
): [T | U, () => void]