Reduce a GraphQL Subscription Stream into a Collection with urql

Share this video with your friends

Send Tweet

Now that Subscriptions are working within our app, you'll notice that we are receiving individual comments from the Subscription stream that are overwriting each other.

We want all the comments that come in! To handle this, we'll write a handleSubscription function that will reduce all the comments coming in into an array that we can render in the app.