Created
April 13, 2024 19:59
-
-
Save pshaddel/a9a30d763c612b8e0206ab42f9e8d0f5 to your computer and use it in GitHub Desktop.
useState implementation in ReactHooks.js file
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
export function useState<S>( | |
initialState: (() => S) | S, | |
): [S, Dispatch<BasicStateAction<S>>] { | |
const dispatcher = resolveDispatcher(); | |
return dispatcher.useState(initialState); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment