Creating Reusable Mocks
Now that you know how to use libraries and prebuilt mocks, it is time for us to develop our own mocks.
Interfacing components with API: useTasks
hook
Though we have our API helpers written, this is not enough to make tasks persistent. In order to connect the React components and the underlying API functions, create a useTasks
hook, which would take the responsibility of polling and updating tasks.
We want it to:
- Request the list of tasks on the render.
- Make them
Access this course and 1400+ top-rated courses and projects.