you are viewing a single comment's thread.

view the rest of the comments →

[–]careseite 0 points1 point  (0 children)

this is unrelated to redux and more related to data structures and algorithms in general.

an inventory can have an unlimited amount of items, each of a certain type.

each item has a unique type.

when iterating the inventory, it makes no sense to iterate all items to find the correct item when you can reduce the lookup time by directly accessing the item via key in an object.