DEV Community

Discussion on: How to write 90% cleaner code with Hooks 🎣

Collapse
 
xr0master profile image
Sergey Khomushin

I see your new code with hooks for 2 fields and it looks awkward... If you have 50 fields?

Collapse
 
aman_singh profile image
Amandeep Singh

Then you either use your custom hook combining the relevant fields, or use useReducer.

Collapse
 
xr0master profile image
Sergey Khomushin

useReducer with 50 cases? Custom hook is a solution, but its development is more difficult for developers. Who don't understand this, cannot design it. I already imagine a ton of terrible code from juniors in Internet... IMO