If you're using React, there's a good chance you've been writing functional components with hooks for a while now. And I think most of us would agree that hooks make our components cleaner and more elegant. But hooks have a dark side too - they can be confusing and make code more difficult to reason about. And what's going on with the Rules of Hooks? Why can I only use hooks inside component functions? And why can't I call them conditionally?
To find out, we're going to have a look at how hooks work under the covers. We can then use this information to better understand what's going on in the hooks we use and help us to write our own custom hooks.