Guest User

Untitled

a guest
Feb 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import React, {Component} from 'react'
  2. import {Rehydrated} from 'aws-appsync-react'
  3. import {ApolloProvider} from 'react-apollo'
  4. import AWSAppSyncClient from 'aws-appsync'
  5. import appSyncConfig from './AppSync'
  6.  
  7.  
  8. const appSyncClient = new AWSAppSyncClient({
  9. url: appSyncConfig.graphqlEndpoint,
  10. region: appSyncConfig.region,
  11. auth: { type: appSyncConfig.authenticationType, apiKey: appSyncConfig.apiKey }
  12. });
  13.  
  14. export default function apolloProviderHOC(WrappedComponent) {
  15. return class PP extends Component {
  16. render() {
  17. return (
  18. <ApolloProvider client={appSyncClient}>
  19. <Rehydrated>
  20. <WrappedComponent {...this.props} />
  21. </Rehydrated>
  22. </ApolloProvider>
  23. );
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment