TLDR Dev · ARTICLES & TUTORIALS

START NAMING YOUR USEEFFECT FUNCTIONS, YOU WILL THANK ME LATER

neciudan.dev12 min read

Summary from the TLDR Dev newsletter

Naming your useEffect callbacks instead of leaving them as anonymous arrow functions makes it easy to skim a component's intent from function names alone. The naming also acts as a design forcing function. If you can't name an effect without “and,” it's doing too much, and if the best name sounds like internal state shuffling, it probably shouldn't be an effect at all.