programming.dev
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
BlackEco@lemmy.blackeco.com to ReactEnglish · 4 days ago

Start naming your useEffect functions, you will thank me later

neciudan.dev

external-link
message-square
2
link
fedilink
12
external-link

Start naming your useEffect functions, you will thank me later

neciudan.dev

BlackEco@lemmy.blackeco.com to ReactEnglish · 4 days ago
message-square
2
link
fedilink
I started naming my useEffect functions about a year ago. It changed how I read components, how I debug them, and eventually how I structure them.
  • BlackEco@lemmy.blackeco.comOP
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    The author actually addresses this point, explaining that since you name your effects, you should realise when they are used to sync states and take action.

    As a side-note, eslint-plugin-react-you-might-not-need-an-effect might be better suited to catch these.

React

react

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

A community for discussing anything related to the React UI framework and it’s ecosystem.

https://react.dev/

Wormhole

[email protected]

Icon base by Skoll under CC BY 3.0 with modifications to add a gradient

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 2 users / day
  • 14 users / week
  • 15 users / month
  • 129 users / 6 months
  • 382 local subscribers
  • 1.32K subscribers
  • 88 Posts
  • 78 Comments
  • Modlog
  • mods:
  • Ategon
  • CUFTA22
  • Berserker
  • BE: 0.19.13
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org