Last active
September 19, 2018 15:05
-
-
Save unicodeveloper/db4e9c11125a48f23c09e07e9afd9ad1 to your computer and use it in GitHub Desktop.
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
const DogPhoto = ({ breed }) => ( | |
<Query | |
query={GET_DOG_PHOTO} | |
variables={{ breed }} | |
skip={!breed} | |
pollInterval={500} | |
notifyOnNetworkStatusChange | |
> | |
{({ loading, error, data, networkStatus }) => { | |
if (networkStatus == 6) return "Polling for data..Stay tuned!"; | |
if (loading) return null; | |
if (error) return `Error!: ${error}`; | |
return ( | |
<img src={data.dog.displayImage} style={{ height: 100, width: 100 }} /> | |
); | |
}} | |
</Query> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment