I'm trying to use the reactive variables:
My cache file :
import { makeVar } from "@apollo/client"
export const colorVar = makeVar('red')
File A (updating the value):
import { colorVar } from "cache"
colorVar('green')
File B (reading the value and should re-render after the value updated in File A):
import { colorVar } from "cache"
console.log(colorVar())
The update action in file A does not trigger the re-render of file B
cache file (use that cache for ApolloClient):
Update the variable (File A):
Read the variable (File B):
Update: From Apollo Client 3.2.0 you can use the useReactiveVar hook to get the data (File B):