@blockstack/ui
Version:
Blockstack UI components built using React and styled-components with styled-system.
16 lines (15 loc) • 610 B
TypeScript
import * as React from 'react';
export declare function useControllableProp<T>(propValue: T | undefined, stateValue: T): readonly [boolean, T];
export interface UseControllableStateProps<T> {
value?: T;
defaultValue?: T | (() => T);
onChange?: (nextValue: T) => void;
shouldUpdate?: (prevState: T, state: T) => boolean;
name?: string;
propsMap?: {
value?: string;
defaultValue?: string;
onChange?: string;
};
}
export declare function useControllableState<T>(props: UseControllableStateProps<T>): [T, React.Dispatch<React.SetStateAction<T>>];