---
title: "Comment by Badal sharma on \"A Look At React Hooks: useCallback\" | Hashnode"
description: "Increase and Decrease anyway are not getting called again and again when the component gets rerendered then why did you use useCallback ?"
url: "https://hashnode.com/posts/a-look-at-react-hooks-usecallback/60463c3b73cc1742999bfae3/comment/60473ecca2c0664a97e77fde"
---

[Discussion](https://hashnode.com/posts/a-look-at-react-hooks-usecallback/60463c3b73cc1742999bfae3)

Comment [A Look At React Hooks: useCallback](https://hashnode.com/posts/a-look-at-react-hooks-usecallback/60463c3b73cc1742999bfae3)

[Badal sharma](https://hashnode.com/@badal897)

[Mar 9, 2021](https://hashnode.com/posts/a-look-at-react-hooks-usecallback/60463c3b73cc1742999bfae3/comment/60473ecca2c0664a97e77fde)

Increase and Decrease anyway are not getting called again and again when the component gets rerendered then why did you use useCallback ?

[Victoria Lo](https://hashnode.com/@victoria)

[Mar 10, 2021](https://hashnode.com/posts/a-look-at-react-hooks-usecallback/60463c3b73cc1742999bfae3/comment/60473ecca2c0664a97e77fde#reply-60483346c64c63545921cd3b)

Hi thanks for the question. Every time a React component re-renders, a new function gets created. So without the `useCallback`, new increase and decrease functions are created every time the App component renders.

This is known as referential equality. The increase and decrease functions that loads on every render does not point to the same functions in memory (even though they have the same name, logic, etc.).

Using useCallback tells React to cache the increase and decrease functions if `number` does not change. When `number` is changed, the function is then updated.

So, only using React.memo() will still result in unnecessary components rendering because the increase and decrease functions passed as props in Counter are returned as new functions each time app renders. The React.memo(Counter) component detects a change in the component's props and therefore will re-render it. ![onlymemo.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1615345667578/tBLT3lJMV.gif)

I hope that explains it. I will edit the article to make it more clear. Thanks!
