improve defaults for useRoomState and useStateToggle hooks
This commit is contained in:
parent
8d4ac90265
commit
13a2f779b9
2 changed files with 5 additions and 2 deletions
|
@ -18,7 +18,7 @@ import {Dispatch, SetStateAction, useState} from "react";
|
|||
|
||||
// Hook to simplify toggling of a boolean state value
|
||||
// Returns value, method to toggle boolean value and method to set the boolean value
|
||||
export const useStateToggle = (initialValue: boolean): [boolean, () => void, Dispatch<SetStateAction<boolean>>] => {
|
||||
export const useStateToggle = (initialValue = false): [boolean, () => void, Dispatch<SetStateAction<boolean>>] => {
|
||||
const [value, setValue] = useState(initialValue);
|
||||
const toggleValue = () => {
|
||||
setValue(!value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue