I don't know which this question is insignificant but it is quite confusing for me right now.
I have a state
, which will be used as params to make API call. So I assume this state
, aka API Object
, should be one-one mapping to backend API. However, if I change one value of of API Object
, say state.api.A
, it will affect available values for another field, say availableB
. These available values can be computed purely or fetched remotely.
So here I will have two choices: 1) to separate availableB
from API Object
, or 2) to store every availableB
inside API Object
.
Method 1) cons: change to any field of API Object
should be an effect otherwise I have to dispatch two reducers for one change.
Method 2) cons: I have to remember removing Assistant Object
before I make API calls.
Which one is the correct practice or this question is totally something about over designed?
Aucun commentaire:
Enregistrer un commentaire