React has changed, your Hooks should too

Chris Coyier Chris Coyier on

Matt Smith:

React Hooks have been around for years, but most codebases still use them the same way: a bit of useState, an overworked useEffect, and a lot of patterns that get copy-pasted without much thought. […]

Before reaching for useEffect, ask yourself:

  • Is this driven by something external (network, DOM, subscriptions)?
  • Or can I compute this during render?

If it’s the latter, tools like useMemouseCallback, or framework-provided primitives will make your component a lot less fragile.

Need to learn about web performance?

Frontend Masters logo

We have an in-depth course all about Web Performance Fundamentals from Todd Gardner. There is a lot to know, from the psychology of web performance, to measuring the new Core Web Vitals (LCP! INP! CLS!), to building a culture of performance at your organization.

One response to “React has changed, your Hooks should too”

  1. Antonio Carvalho says:

    I changed to Svelte and I’m not coming back!

Leave a Reply

Your email address will not be published. Required fields are marked *

$916,000

Frontend Masters donates to open source projects through thanks.dev and Open Collective, as well as donates to non-profits like The Last Mile, Annie Canons, and Vets Who Code.