Skip to content

Commit

Permalink
FIX: react-apollo now needs wider context, so delegate responsibility…
Browse files Browse the repository at this point in the history
… as they wish
  • Loading branch information
langpavel committed Aug 22, 2017
1 parent 4f7a1f5 commit 61bdcae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Provider as ReduxProvider } from 'react-redux';
import { ApolloProvider } from 'react-apollo';

const ContextType = {
// Enables critical path CSS rendering
Expand Down Expand Up @@ -59,9 +60,15 @@ class App extends React.PureComponent {
}

render() {
// Here, we are at universe level, sure? ;-)
const { client } = this.props.context;
// NOTE: If you need to add or modify header, footer etc. of the app,
// please do that inside the Layout component.
return React.Children.only(this.props.children);
return (
<ApolloProvider client={client}>
{this.props.children}
</ApolloProvider>
);
}
}

Expand Down

0 comments on commit 61bdcae

Please sign in to comment.