Be more professional as a React developer
I am sharing with y'all my experience, always separate your Business logic from your UI implementation, don't mix them, this will make your application look decent and scalability easy as well as in future whenever you want to update your UI design you don't have to mess with your Business logic.
To achieve this , use custom hooks which will be responsible for managing your business logic and return the data or function your UI need from this hook.
Top comments (2)
Hard to separate BL this way, because hooks just started from view component. In my view redux-saga is much cleaner way to implement whole BL. I use saga without redux : use-saga-reducer
You didn't get my point.
Just export the array with the values and functions returned by your hooks, sometimes we have multiple hooks which depend or share state with each other. You can export these as a Custom hook which will definitely give a better developer experience. Now every React library has hooks so you should know how to get more from this feature.