-
Finished the full stack apollo tutorial
- Learnt about how you it possible to use the apollo cache as a state management tool by making use of Reactive Variables via the
makeVar
function. You can define reactive varibles client side like so
// Initializes to true if localStorage includes a 'token' key, // false otherwise export const isLoggedInVar = makeVar<boolean>(!!localStorage.getItem('token')); // Initializes to an empty array export const cartItemsVar = makeVar<string[]>([]);
This can be acessed in Mutation hooks via any of the callback functions simply by calling the name of the reactive var as a function e.g
isLoggedInVar()
- Learnt about how you it possible to use the apollo cache as a state management tool by making use of Reactive Variables via the
-
Need to play around with
cache.modify
in more detail. This can let us modify the apollo cache in any way.