Last active
October 24, 2021 12:16
-
-
Save chadmuro/d468ef7d5029182a50ca1803e1060e9a to your computer and use it in GitHub Desktop.
useState Type
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
/** | |
* Returns a stateful value, and a function to update it. | |
* | |
* @version 16.8.0 | |
* @see https://reactjs.org/docs/hooks-reference.html#usestate | |
*/ | |
function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>]; | |
// convenience overload when first argument is omitted | |
/** | |
* Returns a stateful value, and a function to update it. | |
* | |
* @version 16.8.0 | |
* @see https://reactjs.org/docs/hooks-reference.html#usestate | |
*/ | |
function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment