News for hackers. Stuff that matters.
Re:React is becoming a black box by laurent123456 on Thursday September 03, 2020 @11:40AM (#24365092)
My experience has been the exact opposite. Class-based components encourage creating large monolithic classes because it's hard to split class methods into smaller units.

With hooks however, you can create self-contained custom hooks that group all the code of a feature in one separate file. It's much easier to test and to make sense of. It's also easier to make the hook more generic and re-usable when it becomes needed by other components.

I'm definitely not going back to class-based components as I find React hooks a lot easier to manage and maintain.

There are no comments on this comment yet.