Example: Avoiding rerenders using React.memo and useCallback.

Memoized Addvocado, will only rerender if props (memoizedAddvocado) change . Since props are cached , will not change

Click Button . Check console.log, addAvocado will cause rerenders

Click Button . Check console.log, memoizedAddvocado will not cause rerenders