Let's say I have a list of products that can be filtered by type
when user selects a different type
from a dropdown (there are other filters users can set as well but they aren't relevant to this example).
I have State A that holds the currently filtered products. State B holds the currently selected type.
When user changes a type, I want it to also update the currently filtered products.
What is the proper way to do this?
- I could call a 'set' action on State A from State B whenever State B is set
- I could call a 'set' action on both State A and State B when a user sets State B
- I could listen to State B in State A and update State A when State B changes
- I could just have the type in State A as well, but I use the type for other separate states for other features as well