Basically, from an API request, I have an array containing catalogs with a list of items which can be favorited. I display them using three main React components with hooks:
Livewhich makes the API request, stores the catalogs in state, and display oneCatalogat a timeCatalogwhich receives items as a prop and ahandleFavoritefunction and displays a list ofItemItemwhich receives an item as props and thehandleFavoritefunction and displays a like or dislike button
Is there any way I can modify the favorited property of a single item in the Catalog component using hooks? Otherwise, since the catalogues are stored in state in the Live component, does that mean I have to recreate the whole array of catalogues every time I have to update one item in one catalog?
There could be a few thousand items in all catalogs combined so it doesn't seem like a good way to handle that. I also thought about useContext but that doesn't seem to be what it's meant for.