Summary
In this chapter, we first learned how to set up a simple API server from a JSON file. Then, we learned how to fetch and create posts using Effect and State/Reducer Hooks. Next, we implemented the same functionality using the TanStack Query library, which simplified our code and allowed us to leverage its caching abilities. Finally, we learned how to deal with loading states using React Suspense and error states using Error Boundaries.
In the next chapter, we are going to learn about form handling in depth, by using Form Actions and Hooks, such as the useActionState
Hook to handle form states and the useOptimistic
Hook to implement optimistic updates.