We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a9d05e commit 869f767Copy full SHA for 869f767
src/useToggle.ts
@@ -9,8 +9,8 @@ const useToggle: UseToggle = state => {
9
const [value, setValue] = useState<boolean>(state);
10
11
const toggle = (nextValue?: boolean) => {
12
- if (typeof nextValue === 'boolean') {
13
- setValue(nextValue);
+ if (typeof nextValue !== 'undefined') {
+ setValue(!!nextValue);
14
return;
15
}
16
0 commit comments