Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andres-torres-marroquin/1a30b671c50f1e8e13a47baa5990a3f3 to your computer and use it in GitHub Desktop.
Save andres-torres-marroquin/1a30b671c50f1e8e13a47baa5990a3f3 to your computer and use it in GitHub Desktop.
useBooleanState hook
useBooleanState = (initialValue) ->
[value, setValue] = React.useState initialValue
setTrue = React.useCallback ->
setValue yes
, []
setFalse = React.useCallback ->
setValue no
, []
[value, setTrue, setFalse]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment