The example e-commerce React app from 8.1.1: Create React App Full-Stack Setup uses lifting functions (prop functions) to move data between the sibling components, for example when we add an item to the cart.
Refactor the app with useContext to store and access from context all state variables in App that are used in child components (items, cart, selectedItemIndex). Fork the frontend repo to make changes.
When to use context in practice
This exercise will help us understand the mechanics of useContext but in practice we would not use useContext for a simple app like this. useContext is best used in apps where we would need to pass state from parents to multiple descendants several levels deep.