Last active
December 18, 2017 10:27
-
-
Save christiearcus/e60d3f82a38c63901fc2e0a220b450d3 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
// add an option to your query, which forces apollo to make the request on the client. | |
export default graphql(Query, { | |
options: { ssr: false } | |
}); |
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
// to prevent the client throwing an error while the API request is still happening, put this handy guard in before rendering the component. | |
export default ({ data }: any) => { | |
if (data.loading) { | |
return <div> loading </div>; | |
} | |
return ( | |
<Component /> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment