This function is a react hook for boolean state that comes with useCallbacks for 'turning on', 'turning off' and toggling the state.
useCallback
The return type of useBooleanState(true) is an array where:
useBooleanState(true)
boolean
() => void
As such, the items in the array can be destructured and named whatever you like:
import { useBooleanState } from '@oneblink/apps-react'const [dialogIsOpen, openDialog, closeDialog, toggleDialog] = useBooleanState(true) Copy
import { useBooleanState } from '@oneblink/apps-react'const [dialogIsOpen, openDialog, closeDialog, toggleDialog] = useBooleanState(true)
These properties can then be used like:
openDialog()closeDialog()toggleDialog() Copy
openDialog()closeDialog()toggleDialog()
This function is a react hook for boolean state that comes with
useCallback
s for 'turning on', 'turning off' and toggling the state.Return
The return type of
useBooleanState(true)
is an array where:boolean
(the state).() => void
(a function that sets the state to true).() => void
(a function that sets the state to false).() => void
(a function that toggles the state to the opposite of what it currently is).As such, the items in the array can be destructured and named whatever you like:
These properties can then be used like: