fix: use function to correctly update state in useToggle

This commit is contained in:
Va Da 2019-01-04 21:30:39 +01:00 committed by GitHub
parent dd81ba56f5
commit d854d27208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ const useToggle: UseToggle = state => {
return;
}
setValue(!value)
setValue(value => !value)
};
return [value, toggle];