Reaction-apollo providing data and mutation to a component

I used to use the prev version where I could use connect to provide data and mutation methods for a component like this:

export default connect({
  mapQueriesToProps,
  mapMutationsToProps,
})(component);

      

And in each mapQueriesToProps

and mapMutationsToProps

I could provide many instances, for example 2-3 data requests and several mutation methods.

But how to do it using the following template in the new version?

export default graphql(data, {
  options: ({ params: { id } }) => ({
    variables: {
      id: Number(id),
    },
  }),
})(component);

      

+3


source to share


1 answer


You can use compose

multiple times.



Compose all mutations and all requests and then create them in your component.

0


source







All Articles