Using mutations with subscriptions

Apart from using a subscription to receive messages in a conversation, they can also be used to display the messages you send yourself. Previously, you used the refetchQueries prop on a Mutation component to resend documents with any queries that would have been affected by the mutation you've executed. By using subscriptions, you no longer have to refetch, for example, the conversation query, as the subscription will get the new message you've just sent and add it to the query.

In the previous section, you used a Query component from react-apollo to send a document to the GraphQL server, while in this section, the new React Apollo Hooks will be used.

The React Apollo Hooks can be used from the react-apollo ...

Get React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.