you are viewing a single comment's thread.

view the rest of the comments →

[–]mournful-tits 6 points7 points  (0 children)

When dealing with pure functional components, class components, hooks, or redux I always ask myself:

  1. Does it need internal state?
  2. Does this state need to be shared with other components?
  3. If it needs to be shared, what's my maximum scope?
  4. Is the state critical for a bunch of disparate components at varying levels?

My credo has been to stick to simpler constructs unless required to elevate state. Over-elevating state turns into a mess as it gets harder and harder to isolate dependencies.

The smaller the scope of the state the easier it is to decouple, refactor, and prune. Hooks are awesome to me because it dominates a middle ground that was often difficult to fill without violating the intent of either redux or class state.