Skip to content

Instantly share code, notes, and snippets.

@coryhouse
Created July 6, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coryhouse/a5a8c9f15525114e7c2ca179e5eb6f4a to your computer and use it in GitHub Desktop.
Save coryhouse/a5a8c9f15525114e7c2ca179e5eb6f4a to your computer and use it in GitHub Desktop.
import React from "react";
import useFetch from "./useFetch";
export default function HookDemo() {
const { data, loading, error } = useFetch("users");
if (loading) return "Loading...";
if (error) return "Oops!";
return data[0].username;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment