Lists
Applications frequently need to keep track of groupings of a resource type. That's what lists are for. A list is an array of resource IDs. You can make as many lists as you would like for each resource type.
Here are two situations when you might find lists useful:
Keeping track of a server-side sorted array of resources
If your UI allows user to "select" resources on your interface by clicking a
checkbox, then you could store the "selected" IDs in a list
The above isn't meant to be exhaustive; it is simply to give you an idea of the kinds of situations where lists can be useful. Any time that you need a subsection of your resources (whether it needs to be ordered or not), you should use lists.
The following shows what two lists look like in a resource slice:
List Names
A good list name is short and descriptive. Here are some examples:
mostRecent
searchResults
favorites
selected
You could include the resource type in the name, too (i.e. "selectedBooks").
Sometimes, you may need to use a dynamic list name. A dynamic list name is a string that has a variable component to it, such as:
It is okay to use dynamic names, but keep in mind that static names are simpler to manage, so you might find them preferable to use over dynamic list names.
Sometimes, you may think that you need a dynamic list name when another approach is better.
This might look like:
Accessing the Resources in a List
Updating Lists
Last updated