useShopping - Focused hook for the computed shopping list
Subscribes to the menu, recipes and purchased slices of the RecipeDatabase
singleton via useSyncExternalStore and derives the shopping list using the pure
computeShoppingList function. Re-renders whenever any of those three slices
change.
Components that only manage the menu (add, remove, toggle cooked) should use
useMenu instead to avoid subscribing to the recipe catalogue unnecessarily.
useShopping - Focused hook for the computed shopping list
Subscribes to the
menu,recipesandpurchasedslices of the RecipeDatabase singleton viauseSyncExternalStoreand derives the shopping list using the purecomputeShoppingListfunction. Re-renders whenever any of those three slices change.Components that only manage the menu (add, remove, toggle cooked) should use
useMenuinstead to avoid subscribing to the recipe catalogue unnecessarily.