Last active
June 3, 2017 16:22
-
-
Save peggyrayzis/65f1f771216c021a9991a9a93e747423 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
import React, { Component } from 'react'; | |
import { graphql } from 'react-apollo'; | |
import { MatchSummary, NoDataSummary } from '@mls-digital/react-components'; | |
import MatchSummaryQuery from './match-summary.graphql'; | |
// here we're using the graphql HOC as a decorator, but you can use it as a function too! | |
@graphql(MatchSummaryQuery, { | |
options: ({ id, season, shouldPoll }) => { | |
return { | |
variables: { | |
id, | |
season, | |
}, | |
pollInterval: shouldPoll ? 1000 * 60 : undefined, | |
}; | |
}; | |
}) | |
class MatchSummaryContainer extends Component { | |
render() { | |
const { data: { loading, match } } = this.props; | |
if (loading && !match) { | |
return <NoDataSummary />; | |
} | |
return <MatchSummary {...match} />; | |
} | |
} | |
export default MatchSummaryContainer; |
Yes you're totally right, good catch! I forgot to convert that since the next section is where I map the results to new props. 😀 Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
const { loading, ...matchSummaryProps } = this.props;
Wouldn't this come in as
this.props.data
?