I agree with the view that functions (with/without props) used in components, in general, should be wrapped in a useCallback function if only you intend to prevent unnecessary re-renders as you've mentioned. However there are some exceptions, if say, it won't lead to much significant performance.
As the developer, how would you know that?
Therefore, I think that this then comes down to on behalf of the developer to use their "programming wisdom" to either include it or not.
BTW: Adding comments to suggest the developer who wishes to use such function props is not so much of a bad idea :¬)
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.
I agree with the view that functions (with/without props) used in components, in general, should be wrapped in a
useCallbackfunction if only you intend to prevent unnecessary re-renders as you've mentioned. However there are some exceptions, if say, it won't lead to much significant performance.As the developer, how would you know that?
Therefore, I think that this then comes down to on behalf of the developer to use their "programming wisdom" to either include it or not.
BTW: Adding comments to suggest the developer who wishes to use such function props is not so much of a bad idea :¬)