useToggle

Switch between two or more values, a boolean by default.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Without arguments it flips a boolean, with a list it cycles through the values.

APIs

useToggle

const useToggle = <T = boolean>(
  options?: readonly T[]
) => readonly [T, (value?: T) => void]
Edit this page on GitHub