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
autoState
function invocation is automatic:newState
argumentIn most cases the
newState
parameter is not useful andautoState
recalculation function looks for the more usefulchangedPaths
attribute.Key points:
autoState
should be somehow related to the changed attributesautoState
must be synchronous (so no possibility to call e.g. REST API)Example: provided there is a state like this
the
brand
,model
,production
are constants (as these never change), but thevaluationUSD
of the car is related tochassis
,body
andmileage
attributes.The key point is: there is no direct
"decrease-valuation"
action! . ThevaluationUSD
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.