We started using the [email protected] in one of our react-redux application and we are trying to replace most of the redux stuff with graphql. So we started using the <Query>
component and converted some pages to use the <Query>
component. But in some pages, we have some existing logic which uses react lifecycle events like componentWillReceiveProps and if we used the <Query>
component then those events won't get fired and if we use HOC type querying like below then the lifecycle events get fired and we will get the data in the props
export default graphql(GET_APP_INFO, { options: ownProps => ({ variables: { appName: ownProps.params.app } }) })
My understanding is that the component is the latest way to query and HOC is the old way which may get deprecated, also I saw some other way to query with withApollo() like below.
this.props.client.query({ query: gql
...
, variables: { ... }, });
So I am looking for suggestions on when to use these different types of querying patterns to get the data