DEV Community

Discussion on: Custom Hooks vs Class vs Other... What is your choice?

Collapse
 
pavelkeyzik profile image
Pavel Keyzik

I prefer to use hooks. For me hook is like Controller of some feature. With hook it looks easier to share any code between any components. Also, with hooks I’m able to start write business logic earlier than I did that with Redux before. I haven’t use classes for a year and didn’t have any problems. Just one issue that I had with hooks is that when I use API requests, then I can do something wrong and get two requests just because I used hook twice in different components. Contexts solve this but for me it’s challenging to keep in mind this 😄 Hope that I’ll never get same requests again and again