Apply What You Learned
Apply your knowledge about the context API and the useReducer()
Hook to some real problems.
Activity 10.1: Migrating an App to the Context API
In this activity, your task is to improve an existing React project. Currently, the app is built without the context API and so cross-component state is managed by lifting the state up. In this project, prop drilling is the consequence in some components. Therefore, the goal is to adjust the app such that the context API is used for cross-component state management.
Note
You can find the starting code for this activity at https://packt.link/93LSa. When downloading this code, you'll always download the entire repository. Make sure to then navigate to the subfolder with the starting code (activities/practice-1/starting-code
in this case) to use the right code snapshot.
The provided project also uses many features covered in earlier chapters. Take your time to analyze it and understand the provided code...