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?

2 responses to “React has changed, your Hooks should too”

  1. Antonio Carvalho says:

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

  2. Yeah I’m not fond of React’s hooks either, I think what React provides are the building block hooks, but better state management needs to be built on top of that. That was the inspiration for https://github.com/Wildhoney/Chizu

Leave a Reply

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

$966,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.