Skip to content

Instantly share code, notes, and snippets.

@KonnorRogers
Created July 20, 2023 18:50
Show Gist options
  • Save KonnorRogers/f83c4a9f729b1f28ca387e6d1fc6dc05 to your computer and use it in GitHub Desktop.
Save KonnorRogers/f83c4a9f729b1f28ca387e6d1fc6dc05 to your computer and use it in GitHub Desktop.
useState with JSDOC
// @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