useCallback
Before addressing this question, I was studying the situation where functions enter the dependency array of useEffect
.
Typically, when creating a custom hook, the hook receives state values from the component’s props and uses them in the dependency array of useEffect
for handling operations
So, what happens when a function is received as a prop? I contemplated this.
Why Functions Are Included in the Dependency Array
Whenever a React component renders, functions are recreated.