Created
July 20, 2023 18:50
-
-
Save KonnorRogers/f83c4a9f729b1f28ca387e6d1fc6dc05 to your computer and use it in GitHub Desktop.
useState with JSDOC
This file contains hidden or 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
// @ts-check | |
import * as React from "react" | |
/** | |
* @template T | |
* @typedef {ReturnType<typeof import("react").useState<T>>} useState | |
*/ | |
export default function () { | |
/** @type {useState<string>} */ | |
const [message, setMessage] = useState() | |
// Verbose method | |
/** @type {ReturnType<typeof import("react").useState<string>>} */ | |
const [message1, setMessage1] = useState() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment