React Hooks: The Good, The Bad, and The Ugly

React Hooks are an elegant and clever idea, but they can be challenging to use in practice. Here’s why the pros of Hooks outweigh the cons. The pros of Hooks outweigh the cons, but it’s not a landslide victory.

Hooks burst onto the scene with the release of React 16.8 with the lofty goal of changing the way we write React components. The dust has settled, and Hooks are widespread. Have Hooks succeeded?

The initial marketing pitched Hooks as a way of getting rid of class components. The main problem with class components is that composability is difficult. Resharing the logic contained in the lifecycle events componentDidMount and friends led to patterns such as higher-order components and renderProps that are awkward patterns with edge cases. The best thing about Hooks is their ability to isolate cross-cutting concerns and be composable.

  • The good
  • The bad
  • The ugly
  • The verdict

#react #javascript

React Hooks: The Good, The Bad, and The Ugly