With a List of Items, whats the best practice to r...
# compose
m
With a List of Items, whats the best practice to remember if specific item is expanded or not ? Item internal state =?
h
I usually keep a set of item ids that are expanded. Keeping the expanded state directly in the item is ok as long as you don't lose it while the item leaves and rejoins the composition. Hoisting has a few more advantages like not querying all the items to know which are expanded if you need that information in the future.
m
ya. i was torn between higher level expanded id list, vs internal item id remember
if the design was 1 expanded at a time, i wud have a lambla and then compare the id outside
thanks!