mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
fix: use function to correctly update state in useToggle
This commit is contained in:
parent
dd81ba56f5
commit
d854d27208
@ -14,7 +14,7 @@ const useToggle: UseToggle = state => {
|
||||
return;
|
||||
}
|
||||
|
||||
setValue(!value)
|
||||
setValue(value => !value)
|
||||
};
|
||||
|
||||
return [value, toggle];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user