Hi Joseph! Thanks for your question... I can see how this statement is confusing.
Let’s take a look at useCallback’s structure. It receives two parameters:
(#1) a function (#2) an array of dependencies
useCallback returns the same instance of the function being passed (parameter #1) instead of creating a new one every time a component re-renders.
It creates a new instance of the function being passed (parameter #1) only when the array of dependencies (parameter #2) changes.
Does this make sense? I will update my post to make sure this definition is more clear. Thanks for your feedback :)
Thanks for the feedback. I think it will be clearer when you update it.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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 Joseph! Thanks for your question... I can see how this statement is confusing.
Let’s take a look at useCallback’s structure. It receives two parameters:
(#1) a function
(#2) an array of dependencies
useCallback returns the same instance of the function being passed (parameter #1) instead of creating a new one every time a component re-renders.
It creates a new instance of the function being passed (parameter #1) only when the array of dependencies (parameter #2) changes.
Does this make sense? I will update my post to make sure this definition is more clear. Thanks for your feedback :)
Thanks for the feedback. I think it will be clearer when you update it.