6 ms·
My experience has been the exact opposite. Class-based components encourage creating large monolithic classes because it's hard to split class methods into smal
by laurent123456 6y ago
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.