Skip to main content

useSetState

Callable

  • useSetState<State>(initialState: State): readonly [state: State, setState: (setStateAction: SetStateActionPartial<State>) => void]

  • @example
    const [state, setState] = useSetState({ count: 1, name: 'John' })

    Type parameters

    • State: Record<string, any>

    Parameters

    • initialState: State

      Initial state.

    Returns readonly [state: State, setState: (setStateAction: SetStateActionPartial<State>) => void]