UNPKG

downshift

Version:

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.

16 lines (15 loc) 876 B
import { type Props, type Reducer } from './index.types'; /** * Computes the controlled state using a the previous state, props, * two reducers, one from downshift and an optional one from the user. * Also calls the onChange handlers for state values that have changed. * * @param reducer Reducer function from downshift. * @param props The hook props, also passed to createInitialState. * @param createInitialState Function that returns the initial state. * @param isStateEqual Function that checks if a previous state is equal to the next. * @returns An array with the state and an action dispatcher. */ export declare function useEnhancedReducer<S extends object, A extends { type: string; }, P extends Props<S, A>>(reducer: Reducer<S, A>, props: P, createInitialState: (props: P) => S, isStateEqual: (prev: S, next: S) => boolean): [S, (action: A) => void];