Question: Different function objects sharing the same code are often created inside React components:function MyComponent ( ) { / / handleClick is re - created on
Different function objects sharing the same code are often created inside React components:function MyComponent handleClick is recreated on each render const handleClick console.logClicked; ; handleClick is a different function object on every rendering of MyComponent.That's when is helpful: given the same dependency values deps, the hook returns the same function instance between renderings aka memoization:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
