Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> One part of the functional promise seems to be that if every piece of functionality is small, isolated and easy to understand that the whole of the application becomes easy to understand.

This part is wrong. Your huge components are made of what? Small things. Isolating all those small things just let you add more boilerplate and mental load when trying to debug. To reduce complexity you have to remove code, not move it around.



I don’t think we promote isolating every little thing. That would indeed be counterproductive.

It’s more about being able to reuse some stateful logic between components. That’s the point of custom Hooks. There are pretty cool libraries existing already. For example React Spring takes advantage of that programming model for animations: https://www.react-spring.io/docs/hooks/use-spring

I tried to explain the motivation for Hooks here:

https://medium.com/@dan_abramov/making-sense-of-react-hooks-...

Hope it helps.


This whole thread is wrong. Nobody said you had to split the functions off into a bazillion files that's just stupid. Youre taking the worst part of enterprisey OO culture and ruining the best part of functional.

And no, you do not need to remove code to reduce complexity you're mistaking correlation for causation.

Boilerplate may occur in the short term during a refactor to pure functions but that can eventually be refactored out once things are unshackled enough to be refactored.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: