The general idea is that you access the Units directly, wherever required, however if two Units make more sense together, you can keep them separate but get their combined value by grouping them together using a Cluster.
// two Unitsexportconstunit1=newDictUnit({initialValue:{a:1}});exportconstunit2=newDictUnit({initialValue:{b:2}});// grouped togetherexportconstmyGroup=newCluster({unit1,unit2})// using shorthand notation// subscribe for reactive grouped value accessmyGroup.subscribe(groupedValue=>console.log(groupedValue))// you'll see {unit1: {a: 1}, unit2: {b: 2}} in the console immediately and // it'll also log any future values
hey MadeInLagny, thanks :)
The general idea is that you access the Units directly, wherever required, however if two Units make more sense together, you can keep them separate but get their combined value by grouping them together using a Cluster.
But how do you access myGroup value in a component where it was not initialised ?
ahh I see, do you mean how to share a Unit or Cluster with multiple components?
you initialize them and export them from a separate file, then you can access them wherever needed, with a simple/direct import.