Summary
In this chapter, we have successfully built a complicated app using the useState
, useEffect
, and useContext
/createContext
hooks. We have learned about the importance of each and what sorts of problems these hooks provide solutions for. Most importantly, we have completely avoided class-based components in the entire process of implementing these complex components, each requiring states and data load/data modification for each event.
Through useEffect
, we have learned how to modify the context to expose a global context to each component that needs to use it without having to resort to deep prop chaining. The data concerns for each component are now optimized, without any additional bloat in our component definitions, which is the ideal state for us. Our components are clean, lean, and very reusable.
In the next chapter, we will explore various external APIs in React in order to fetch data from the servers.