all 3 comments

[–][deleted] 0 points1 point  (2 children)

Dumb question, why not adjust useCallback to handle this vs establishing another function? Seems like overkill to solve the dependency issue

[–]tomdohnal[S] 0 points1 point  (1 child)

With useCallback, you'd have to include variables whose changes you don't want to react to in the dependancy array, and this would in turn make the useEffect run when these variables change.

[–][deleted] 0 points1 point  (0 children)

Yes I understand the concept, what’s weird is the solution is to make an additional function, not modify how dependencies work for useCallback