---
title: "Comment by Muhammad Ilham Robani on \"A Look at React Hooks: useState\" | Hashnode"
description: "Hi Victoria, from what i see in your article about useState hook, you often use a function that returns updated state value rather than directly write the updat"
url: "https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/62a60bb2165482d2b3eee7bf"
---

[Discussion](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345)

Comment [A Look at React Hooks: useState](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345)

[Muhammad Ilham Robani](https://hashnode.com/@hamko)

[Jun 12, 2022](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/62a60bb2165482d2b3eee7bf)

Hi Victoria, from what i see in your article about useState hook, you often use a function that returns updated state value rather than directly write the updated value as an argument. if that sounds confusing, let me direct it with an example:

1.  setMyArray(myArray=> (\[...myArray, 'c'\]))

instead of just this:

1.  setMyArray(\[...myArray, 'c'\])

my question is, is that necessary to do so? i'm sorry if my question sounds stupid to you, but i am kind of new to programming. best regards, Ilham.

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

[Jun 13, 2022](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/62a60bb2165482d2b3eee7bf#reply-62a694be165482d2b3eef8bb)

Hi [Muhammad Ilham Robani](https://hashnode.com/@hamko), yes this is highly recommended as for states that are constantly being updated, using the wrapper around it will ensure that React is updating the current state value and prevent unexpected behaviour.
