Grokking React Advanced
Vote

0% completed

​

Composing and Testing Custom Hooks

How much should a product card know about the cart? In chapter 1, every component that used the cart imported useCart or useCartDispatch and built its action objects itself. A card that shows how many of its product are in the cart would also have to search the items for that product. If two cards wrote these details differently, they could show different results for the same cart. This lesson builds hooks from other hooks, so that a component asks for what it needs in one call: a cart line, a list of search results, a keyboard shortcut. It continues the store page and the `useQuantity

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content