Last active
September 18, 2018 15:25
-
-
Save unicodeveloper/942a2c7ef545c773fb0c8c9e701b82f0 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
export const GetACar = () => ( | |
<Query query={GET_A_CAR} notifyOnNetworkStatusChange> | |
{({ loading, error, data, refetch, networkStatus }) => { | |
if (networkStatus === 4) return "Refetching..."; | |
if (loading) return <p>Loading...</p>; | |
if (error) return <p>Error...</p>; | |
return ( | |
<div> | |
<p> Color: {data.car.color} </p> | |
<p> Year of Manufacture: {data.car.yearOfManufacture} </p> | |
<button onClick={() => refetch()}>Refetch!</button> | |
</div> | |
); | |
}} | |
</Query> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment