DEV Community

Discussion on: The Botched Implementation of useEffect()

Collapse
 
bytebodger profile image
Adam Nathaniel Davis • Edited

Thank you for the feedback! You're actually hitting upon topics that I've addressed in some of my past articles - particularly with regard to declarative style. I won't try to repeat those articles in this comment, but here is a quick breakdown:

  1. You're absolutely correct that declarative style is, in many respects, a complete paradigm shift.
  2. I actually love declarative programming, and it's one of the things that draws me to React.
  3. Even though I love declarative programming, I earnestly believe that some React devs try to follow it to a fault.
  4. As you've pointed out, declarative programming doesn't care about the when. However, I think it's honestly kinda silly to assume that we can build most large-scale applications without ever worrying about the when. When can be extremely important - and sometimes, there simply is no declarative analog when you need to ensure that A is followed by B which is followed by C.
  5. A perfect example of this is with API calls. I've seen soooo many React API tutorials that try to cram all the API calls into a declarative paradigm - and they haphazardly leak repeated, unnecessary HTTP calls.
  6. So while I agree with the theory of what you're saying, I don't think it's accurate (or wise) to assume that all issues (with useEffect() - or with any other aspect of the framework) can simply be "washed away" by switching paradigms to a declarative model.
  7. Thanks for that link. I don't have the time to read through all of it at this minute, but I'm definitely bookmarking it.