Created
February 14, 2019 18:12
-
-
Save danielkcz/34db15c257b253a62c65c16bfd3143a4 to your computer and use it in GitHub Desktop.
useQuery
This file contains 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 { useQuery } from 'react-apollo-hooks' | |
const RandomGiphy = ({ tag }) => { | |
const { data } = useQuery( | |
RandomGiphyQuery, { | |
variables: { tag } | |
} | |
} | |
// handle loading & error states... | |
return <img src={data.giphy.random.url} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment