v3 (latest)
Local State
Reactive Variables

Reactive Variables

New in Apollo Client 3, reactive variables are a useful mechanism for storing local state outside the Apollo Client cache. Because they’re separate from the cache, reactive variables can store data of any type and structure, and you can interact with them anywhere in your application without using GraphQL syntax.

Most importantly, modifying a reactive variable automatically triggers an update of every active query that depends on that variable. A query depends on a reactive variable if any of the query’s requested fields defines a read function that reads the variable’s value.

Please read the “Reactive variables” chapter on Apollo Client documentation.