Hooks
useToggle

Import this in your client-side component

MyComponent.tsx
import { useToggle } from "react-amazing-hooks";

API

ApiDescriptionTypeReturn TypeExample
useToggleA 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. *