Redux: Filter data & rewind to initial data state in Reducer? Redux: Filter data & rewind to initial data state in Reducer? json json

Redux: Filter data & rewind to initial data state in Reducer?


There's two main options. First, if you really do want to keep the "filtered" data directly in your state, you could store two copies: the "original" and the "filtered" versions.

The other approach, which I recommend, is to keep both the original data and the filtering criteria in your state, but don't actually modify the original data. Instead, derive the filtering outside of the store as needed. This is a great use case for "selector functions". See Computing Derived Data for some examples.