Import this in your client-side component
MyComponent.tsx
import { useToggle } from "react-amazing-hooks";
API
Api | Description | Type | Return Type | Example |
---|---|---|---|---|
useToggle | A hook for toggling a boolean state with optional initial value. | InitialValueType<T>, OptionalLocalStorageKey | { value: T, toggle: () => void } | Note * |
Check the InitialValueType
and OptionalLocalStorageKey
in the 'Types' tab.
Check the 'Example' tab above the table for an exhaustive example. *