the brand, model, production are constants (as these never change),
but the valuationUSD of the car is related to chassis, body
and mileage attributes.
The key point is: there is no direct "decrease-valuation" action!
.
The valuationUSD is the consequence of calling one of the following:
"damage-to-chassis"
"damage-to-body"
"add-miles"
actions (and then appropriate reducers).
Moreover, "damage-to-chassis", "damage-to-body", "add-miles" actions don't
require dispatching special "recalculate-valuation" action (although it could
be done this way).
Please note: this is an experimental feature and could change in the future.
Optional state "factory" function that "auto-generates" state.
The "auto" phrase means the
autoStatefunction invocation is automatic:newStateargumentIn most cases the
newStateparameter is not useful andautoStaterecalculation function looks for the more usefulchangedPathsattribute.Key points:
autoStateshould be somehow related to the changed attributesautoStatemust be synchronous (so no possibility to call e.g. REST API)Example: provided there is a state like this
the
brand,model,productionare constants (as these never change), but thevaluationUSDof the car is related tochassis,bodyandmileageattributes.The key point is: there is no direct
"decrease-valuation"action! . ThevaluationUSDis the consequence of calling one of the following:"damage-to-chassis""damage-to-body""add-miles"actions (and then appropriate reducers).Moreover,
"damage-to-chassis","damage-to-body","add-miles"actions don't require dispatching special"recalculate-valuation"action (although it could be done this way).Please note: this is an experimental feature and could change in the future.