Hi,
I am trying to create a simple situation for a shopping lists. I have a list of many products and would like to show the amount of products in the shopping list.
I have a page with the list of all products, that is taken from the API call. Also, I have the currently added product stored locally on the phone in the SQL lite.
The issue that I have is the appropriate state management with this - as I can have 100 products available, while only 10 are already added to the shopping list (with the different quantity, as I have the + and - buttons).
What would you suggest for the state management? Should the page hold the list of all the shopping list elements and the callbacks to every element should be provided with the quantity from the shopping list? Or should the quantity be taken by every element itself? Or is there something else that I haven't think about but it seems like a common problem that should have some best practices in mind.
If someone has any ideas of how something like this should be tackled, I would be extremely glad for it! Thanks!
Hubert