When used properly like the websocket example it’s clear what it does. If you’re using useEffect to sync props and state, then yes, you’re going to have trouble reasoning through it. The solution is to not use useEffect because you’re no longer writing React, you’re writing Angular. No named function expression will fix that.
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.
When used properly like the websocket example it’s clear what it does. If you’re using useEffect to sync props and state, then yes, you’re going to have trouble reasoning through it. The solution is to not use useEffect because you’re no longer writing React, you’re writing Angular. No named function expression will fix that.
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.