apollo-link-state icon indicating copy to clipboard operation
apollo-link-state copied to clipboard

Is it possible to have computed / derived state?

Open gregkerzhner opened this issue 5 years ago • 0 comments

Is it possible to have calculated or derived data from inside the cache? Something similar to https://github.com/reduxjs/reselect?

Lets say I have a list of todos inside my cache, and I want to keep track of a field thats numberOfTodos. Can I set something up where numberOfTodos is calculated automatically based on todos.length? The only way I see to do this currently is to store numberOfTodos as an additional field in the cache which is not ideal because the goal of any state management system should be to store the least amount of data possible and have the rest be derived.

gregkerzhner avatar Apr 17 '19 21:04 gregkerzhner