Skip to content

Add FORCE argument for "toggle" in "useBooleanState" #99

Description

@yairEO

it's beneficial for a toggling function to have an optional argument that, if set to true or false, will force the toggle to that state.

This is handy in such cases:

const {visible, toggle} = useVisibilityState();

const foo = bar => toggle(bar) // where bar is a Boolean state 

instead of:

const {visible, show, hide} = useVisibilityState();

const foo = bar => {
  if (bar) 
    show()
  else
    hide()
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    HooksHooks-relatedenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions