re: React: useCallback hooks simple explanation VIEW POST


Nice article but I missed the answer to this comment from React docs:

The array of dependencies is not passed as arguments to the function. Conceptually, though, that’s what they represent: every value referenced inside the function should also appear in the dependencies array.

So it's not clear is it a dependency array or is it an array for cache'ing control.

The thing is, that all those useCallbacks work with empty array `[]` and from this point, it's not the dependency array.

code of conduct - report abuse