Summary
This chapter introduced you to the new React Hooks API. You started by using the useState()
Hook, which is fundamental for using state in functional React components. Then, you learned about useEffect()
, which enables life cycle management in functional React components, such as fetching API data when a component is mounted and cleaning up any pending async operations when it is removed. Then, you learned how to use the useContext()
Hook in order to access global application data. Lastly, you learned about the useReducer()
Hook – an effective replacement for useState()
when your component state grows too big or too complex for useState()
.
In the following chapter, you'll learn about event handling in React components.