Great feedback! I've only read about useCallback(). Haven't yet found a great time/place to use it. But you're right, this is definitely another one of the valid options.
As you've pointed out, it also has some drawbacks. And I don't personally know if I'd use it in this scenario (in place of my custom Hook). But I definitely think that useCallback() is a better alternative than useEffect(). And I'm thinking that, in some other scenarios where useEffect() drives me nuts, it might be because I should really be using useCallback()...
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.
Great feedback! I've only read about
useCallback()
. Haven't yet found a great time/place to use it. But you're right, this is definitely another one of the valid options.As you've pointed out, it also has some drawbacks. And I don't personally know if I'd use it in this scenario (in place of my custom Hook). But I definitely think that
useCallback()
is a better alternative thanuseEffect()
. And I'm thinking that, in some other scenarios whereuseEffect()
drives me nuts, it might be because I should really be usinguseCallback()
...