Hacker News new | ask | show | jobs
by Scarblac 1573 days ago
When you have multiple hooks in a component it usually makes sense to put them in a function with a good name - a custom hook. It's easy and almost always usually gives simple code.
2 comments

sure, and sometimes it still would be simpler with the older lifecycle methods. Not saying it is always the case but for some reason it is assumed it could never be the case.
a benefit of custom hooks is that you can test complex state logic isolated from the view