Last active
October 26, 2018 00:24
-
-
Save rhmoller/9240ae80ffc3ef1e29e1ac45edd795f4 to your computer and use it in GitHub Desktop.
Module augmentation for @types/react that adds defintions of some of the new hooks in React 16.7.0-alpha.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import {Context, RefObject} from "react"; | |
declare module "react" { | |
function useState<T>(initialState?: T): [T, (value: T) => void]; | |
function useEffect(effect: () => (() => void) | void, dependencies?: Array<any>): void; | |
function useContext<C>(context: Context<C>): C; | |
function useReducer<S>(reducer: (state: S, action: any) => S, initialState?: S, initialAction?: any): [S, (args: any) => void]; | |
function useCallback(callback: () => void, dependencies?: Array<any>): () => void; | |
function useMemo<R>(fn: () => R, dependencies?: Array<any>): R; | |
function useRef<T>(initialValue: T | null): RefObject<T>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just found this which is better: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/30036/files#diff-48f3225134840da288f40a817697e2e9R564