For Redux users here I’ve a question about handling reducers if an action is not required…
I’ve not used Redux in a real project yet as I’m just experimenting with it. It looks like this:
- I have a (custom) dropdown box which says “Select client”
- Inside the list of options is a list of clients
- On change, the “Select client” text changes to the selected client name
- My list of clients are in a reducer with no action and I’m using mapStateToProps in order to get them for the dropdown
- My “Select client” is another reducer which stores the selected client, and has an action to change this based on user selection.
So my questions:
- Is it okay to have a reducer without an action? These would typically come from an API fetch request. Is there a case for this list to be fetched outside of Redux? Admittedly in a larger app I would probably also want to perform actions on the client, but in this case, what would be best practice?
- Is separating things out to such a granular level the right thing to do? In this case the selected client text is just one tiny UI element that changes based on one action.