7 Hooks to fuel your web applications
This chapter covers
- Creating stateful components in a larger perspective
- Optimizing performance using memoization
- Introducing advanced topics solvable by hooks
- Rules to observe when using hooks in general
Hooks are what make modern React applications tick. They're a pretty small part of the overall React API, but very significant nonetheless. Hooks are also quite tricky to use.
In this chapter, we're going to discuss all the hooks and what they do, cover some important things about using hooks in general, and will at the end talk a bit about the dependency array that several hooks accept and what it means in practice.
Hooks are a special kind of creature in the React biosphere. From the outside, they seem completely unrelated in functionality, but when examined closer, they have some common traits and behaviors that we need to account for when using them. You could say that they stem from a common ancestor somewhere in the evolutionary tree, even though they have advanced to become very different beings.
We have dedicated this chapter to all the hooks for this very reason. So while we're going to be covering some wildly different topics, all of them are concerned with using hooks, and we'll try to tie a bow on it at the end by explaining how all of these hooks are in fact related despite their seemingly divergent purposes.