Hi Boris, nice article. I differ on few things:
Your article suggests that we should not use useMemo / useCallback in favor of code readablity. I would argue that using these hooks makes the code even more readable. We now clearly know which pieces of our code actually involves compuation.
Also, in my opinion it's not a good idea to create hooks based upon single responsibility principle. This actually makes the code hard to follow in future. A better principle would be "Every hook must return something that gets used in the UI". In other words, don't break hooks into smaller hooks until you need the intermediate outputs to be displayed in the UI.
I have asked my team to follow these principles and it helps us a lot in manual code reviews and automated code reviews. I would love to hear your thoughts on this guide - shyamswaroop.hashnode.dev/react-pa...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Boris, nice article. I differ on few things:
Your article suggests that we should not use useMemo / useCallback in favor of code readablity. I would argue that using these hooks makes the code even more readable. We now clearly know which pieces of our code actually involves compuation.
Also, in my opinion it's not a good idea to create hooks based upon single responsibility principle. This actually makes the code hard to follow in future. A better principle would be "Every hook must return something that gets used in the UI". In other words, don't break hooks into smaller hooks until you need the intermediate outputs to be displayed in the UI.
I have asked my team to follow these principles and it helps us a lot in manual code reviews and automated code reviews. I would love to hear your thoughts on this guide - shyamswaroop.hashnode.dev/react-pa...