Two concerning trends I'm seeing in modern React apps: 1


Two concerning trends I'm seeing in modern React apps:

1. Creating custom hooks when the Hook is only useful for one component.

2. Declaring a context merely to avoid passing props down to an immediate child.

Needless complexity.

#react
Custom hooks are for *sharing* logic. If the hook is coupled to a single component, a custom Hook = needless abstraction.

Context is for *broadly used* data or functions. If data merely needs to be passed from parent to child, use props. Context would be a needless abstraction.
I suspect this is merely resume driven development. When a new feature comes out, people want to try it, even if their use case doesn't demand it.

But in some cases, devs are cutting paper with an ax.

View original on X