Nesting
Combining Multiple Units to create a Meaningful Cluster
// instead of doing this
const store = new DictUnit({initialValue: {
token: 'auth-token',
userProfile: {...},
userPreferences: {...}
}})
// do this
const tokenUnit = new StringUnit({initialValue: 'auth-token'})
const userProfileUnit = new DictUnit({initialValue: {...}})
const userPreferencesUnit = new DictUnit({initialValue: {...}})
const userDataCluster = new Cluster({
tokenUnit, userProfileUnit, userPreferencesUnit // using shorthand notation
})Accessing and Observing not so nested values of the Unit
Last updated
Was this helpful?