Before we start migrating from class components to Hooks, we are going to create a small ToDo list app using React class components. In the next section, we are going to turn these class components into function components using Hooks. Finally, we are going to compare the two solutions.
Handling state with class components
Designing the app structure
As we did before with the blog app, we are going to start by thinking about the basic structure of our app. For this app, we are going to need the following features:
- A header
- A way to add new todo items
- A way to show all todo items in a list
- A filter for the todo items
It is always a good idea to start with a mock-up. So, let's begin:
- We start by drawing a mock-up of...