Member-only story

Relearning React: From Classes to Hooks

Michael Landis
7 min readJun 22, 2020

--

If you’ve been using React for a while, you’ve seen it evolve from classes to functions, but the documentation hasn’t caught up. It describes Hooks, but still describes component lifecycle in class terms, and it causes a lot of confusion. A year after their introduction, people keep asking how to mimic componentDidUpdate in Hooks, when managing side effects with Hooks is completely different and significantly easier.

Classes Versus Functions: Fields Versus Closures

This is the first article in a 3-part series that looks at how to let go of class component lifecycles when thinking about functional components. It takes a look at the fundamental differences between the two and some of the key elements that need to be understood to dive into using Hooks. The other articles are:

These articles aren’t really meant to explain how to write components. I’m writing these for people who have spent some time getting used to class-based components, decided to get into functional components and Hooks, and got frustrated by…

--

--

Michael Landis
Michael Landis

Written by Michael Landis

Front-end web developer, React enthusiast, vagabond.

Responses (1)