Retrieving
Use store.getGroup()
to access a group from the store:
When you retrieve a group, you will be given the full resources back.
For instance, the above call may return:
If you pass a group name of a group that does not exist to getGroup
, you will receive an empty array back:
Returning the Group as an Object
Although groups are stored as arrays, it is not always the case that the order of that array matters for your use case. In those situations, it may be preferable to get an object returned from the call to getGroup
, rather than an array. The second argument to getGroup
is an options object that allows you to specify this behavior:
This would return an object like the following:
Tips
Although you can also use
store.getState()
to retrieve a group by directly accessing the state tree, we do not encourage that approach.
Last updated