|
|
|
|
|
by codemonkey-zeta
318 days ago
|
|
I agree that this is the approach that keeps react apps simple. The biggest problems I see in react code are giant components that read like this: useState useState useState ... // 20 more useEffect useEffect useEffect ... // 20 more I think a lot of front-end devs don't realize the necessity of custom hooks for composition and modularization. My personal rule is "Never use react hooks (useState, useEffect, etc.) in component code. All react hooks MUST be wrapped by custom hooks." and it makes for MUCH better code: useSomeData useOtherData useMobileView useScrollToTop useInteractionLogging ... // 10 more hooks This is also what makes TanStack so good and popular. It's all just behavior wrapped in hooks. |
|