Shadcn Hooks

useResetState

A hook to reset a state

Loading...

Installation

npx shadcn@latest add @shadcnhooks/use-reset-state

API

type ResetState = () => void

/**
 * A hook to reset a state
 * @param initialState - The initial state
 */
export function useResetState<S>(
  initialState: S | (() => S),
): readonly [S, Dispatch<SetStateAction<S>>, ResetState]

Credits

Last updated on

On this page