Created
May 1, 2018 19:52
-
-
Save afreeland/ad3b445422f7a08e5adcc76210ee23e4 to your computer and use it in GitHub Desktop.
React: Sample Component illustrating Apollo
This file contains hidden or 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 React, { Component } from 'react'; | |
import { render } from 'react-dom'; | |
import { ApolloClient, createNetworkInterface, ApolloProvider, graphql } from 'react-apollo'; | |
import History_HOC from './history-hoc' | |
import appRoot from 'app-root-path'; | |
import store from '../../store'; | |
const config = require(`${appRoot}/config/config.js`); | |
let graphqlClient = require(appRoot + '/models/graphql-client.js'); | |
export default class RecentHistory extends Component { | |
constructor(props){ | |
super(props); | |
this.state = { | |
username: store.getState().userState.username | |
} | |
} | |
render(){ | |
return( | |
<div> | |
<ApolloProvider client={graphqlClient}> | |
<History_HOC username={this.state.username} type="Analytics"/> | |
</ApolloProvider> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment