Skip to content

Instantly share code, notes, and snippets.

@aleksejkozin
Last active January 19, 2021 12:09
Show Gist options
  • Save aleksejkozin/8cb8f1c30f75ad76ce3e5bed19b7ff6d to your computer and use it in GitHub Desktop.
Save aleksejkozin/8cb8f1c30f75ad76ce3e5bed19b7ff6d to your computer and use it in GitHub Desktop.
export type FetchBrowsersResults = {
Browsers: Browser[]
}
export type UseFetch<T> = {
loading: boolean
// We use Generic. T - is a type argument that can be any type.
// We can useFetch() with any type
// ? means, that T can be undefined
data?: T
}
export function useFetch<T>(url: string): UseFetch<T> {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment