2 ms·
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 usual
by Scarblac 5y 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.
- dnsco 5y agoa benefit of custom hooks is that you can test complex state logic isolated from the view
- bryanrasmussen 5y agosure, 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.