Links are created and shared between every request in your application. Some links may share state between requests to provided added functionality. The links are called stateful links and are written using the ApolloLink interface. The alternative way to write links is a stateless link.
Stateful links typically (though are not required to) overwrite the constructor of ApolloLink and are required to implement a request function with the same signature as a stateless link. For example:
It is important when managing stateful links where the request is being saved to implement a key value store for the requests. Otherwise, it is easy to accidentally override an in-flight request with another operation happening. Take for example a portion of the dedup link: