UNPKG

use-merge-state

Version:

A useState variant hook that merges updates.

12 lines (11 loc) 461 B
import { SetStateAction } from "react"; import { DispatchWithOptions } from "../types"; interface MergeOptions { merge?: boolean; } export declare function useMergeState<S>(initialState: S | (() => S), options?: MergeOptions): [S, DispatchWithOptions<SetStateAction<S>, MergeOptions>]; export declare function useMergeState<S = undefined>(): [ S | undefined, DispatchWithOptions<SetStateAction<S | undefined>, MergeOptions> ]; export {};