Last active
October 10, 2018 02:00
-
-
Save peaonunes/42f8079f08e87c8dd311e5737d23609b to your computer and use it in GitHub Desktop.
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 { Query } from 'react-apollo' | |
| import PropTypes from 'prop-types' | |
| import React from 'react' | |
| import { queryEnabledFeatures } from './graphql/query' | |
| class EnabledFeatures extends React.Component { | |
| static propTypes = { | |
| children: PropTypes.func.isRequired | |
| } | |
| render() { | |
| const { children } = this.props | |
| return ( | |
| <Query query={queryEnabledFeatures}> | |
| {({ loading, error, data }) => { | |
| let renderProps = { | |
| loading, | |
| error, | |
| ready: false | |
| } | |
| if (!data) return children({ ...renderProps }) | |
| return children({ ...renderProps, ready: true }) | |
| }} | |
| </Query> | |
| ) | |
| } | |
| } | |
| export default EnabledFeatures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment