---
title: "Comment by Martin Gainza Koulaksezian on \"How to use JavaScript scheduling methods with React hooks\" | Hashnode"
description: "In both cases we use this two lines let currCount = countRef.current; setCounter(currCount = &gt; currCount + 1 ); why we use the same name for the function par"
url: "https://hashnode.com/posts/how-to-use-javascript-scheduling-methods-with-react-hooks/5fa0ef8fad30887ef1e164de/comment/629282680989e6b52feb0125"
---

[Discussion](https://hashnode.com/posts/how-to-use-javascript-scheduling-methods-with-react-hooks/5fa0ef8fad30887ef1e164de)

Comment [How to use JavaScript scheduling methods with React hooks](https://hashnode.com/posts/how-to-use-javascript-scheduling-methods-with-react-hooks/5fa0ef8fad30887ef1e164de)

[Martin Gainza Koulaksezian](https://hashnode.com/@MartinGK)

[May 28, 2022](https://hashnode.com/posts/how-to-use-javascript-scheduling-methods-with-react-hooks/5fa0ef8fad30887ef1e164de/comment/629282680989e6b52feb0125)

In both cases we use this two lines

```
      let currCount = countRef.current;
      setCounter(currCount => currCount + 1);
```

why we use the same name for the function parameter inside the setCounter?

setCounter(**currCount** \=> currCount + 1);

I believed that adding an arrow function inside a setState will make the parameter the last value of the state thus unrelated with the countRef.current, and unrelated with the currCount, which is a local function variable.
