react-use/lib/react.d.ts
2018-10-30 17:03:54 +00:00

14 lines
686 B
TypeScript

export declare type UseState = <T>(initialState: T | (() => T)) => [T, (newState: T) => void];
export declare const useState: UseState;
export declare type UseEffect = (didUpdate: () => ((() => void) | void), params?: any[]) => void;
export declare const useEffect: UseEffect;
export interface ReactRef<T> {
current: T;
}
export declare type UseRef = <T>(initialValue: T) => ReactRef<T>;
export declare const useRef: UseRef;
export declare type UseCallback = <T extends ((...args: any[]) => any)>(callback: T, args: any[]) => T;
export declare const useCallback: UseCallback;
export declare type UseMemo = <T>(fn: Function, args: any[]) => T;
export declare const useMemo: UseMemo;