Hooked on Hooks

Playing around with React Hooks

Daniel Afonso
The Startup

--

Hey everyone, on the aftermath of the workshop Hooked on Hooks — Playing around with React Hooks, I’ve decided to share a bit of it with you. This article focuses on the motivation that led to creating Hooks following a brief introduction to each of them. This article ends with the rules of Hooks.

A significant part of this article is adapted from the docs, and it doesn’t replace reading them and watching “React Today and Tomorrow, and 90% Cleaner React With Hooks”.

A life without Hooks

Let’s go back to a life without Hooks. The main pain points focused on three things:

  • Giant and confusing components
  • Reusing logic between components
  • Confusing classes

Giant and confusing components

Looking at the example above, what do we have?

Three lifecycle components (componentDidMount, componentDidUpdate, and componentWillUnmount) each one of them with blocks of logic that…

--

--

Daniel Afonso
The Startup

Building content, code, and memes🦔💻 🥑Developer Advocate at OLX Group