Questions
To recap what we have learned in this chapter, try to answer the following questions:
- How are React class components defined?
- What do we need to call when using a constructor with class components? Why?
- How do we set the initial state with class components?
- How do we change the state with class components?
- Why do we need to re-bind the
this
context with class component methods? - How can we re-bind the
this
context? - How can we use React Context with class components?
- What can we replace state management with when migrating to Hooks?
- What are the trade-offs of using Hooks versus class components?
- When, and how, should an existing project be migrated to Hooks?