Created
July 6, 2020 15:13
-
-
Save coryhouse/a5a8c9f15525114e7c2ca179e5eb6f4a to your computer and use it in GitHub Desktop.
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
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