UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

10 lines (9 loc) 434 B
export interface UseControllableStateProps<T> { value?: T; defaultValue: T | (() => T); onChange?: (value: T) => void; } /** * `useControllableState` returns the state and function that updates the state, just like React.useState does. */ export declare function useControllableState<T>({ value: valueProp, defaultValue, onChange, }: UseControllableStateProps<T>): readonly [T, (next: React.SetStateAction<T>) => void];