Created
August 16, 2020 18:56
-
-
Save simicd/eb96a960b25eff9015c5a33396a98a74 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
| // DogImage.tsx | |
| import React, { FC } from "react"; | |
| import { useFetch } from "./useFetch"; | |
| type DogImageType = { message: string; status: string }; | |
| export const DogImage: FC = () => { | |
| const data = useFetch<DogImageType>({ | |
| url: "https://dog.ceo/api/breed/beagle/images/random" | |
| }); | |
| return <>{data ? <img src={data.message} alt="dog"></img> : <div>Loading</div>}</>; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment