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.
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 thatsnumberOfTodos
. Can I set something up wherenumberOfTodos
is calculated automatically based ontodos.length
? The only way I see to do this currently is to storenumberOfTodos
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.