---
title: "Comment by Edidiong Asikpo (Didi) on \"A Look at React Hooks: useState\" | Hashnode"
description: "Hey Victoria Lo . I really enjoyed reading the second article of this series, and I am looking forward to the third one. I have a question for you. 😀 Concernin"
url: "https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/602bab9dcc91ac05270efb59"
---

[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)

[Edidiong Asikpo (Didi)](https://hashnode.com/@didicodes)

[Feb 16, 2021](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/602bab9dcc91ac05270efb59)

Hey [Victoria Lo](https://hashnode.com/@victoria). I really enjoyed reading the second article of this series, and I am looking forward to the third one.

I have a question for you. 😀

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613474505615/YhX2TKKHP.png)

Concerning **lazy initial state**, are you saying passing a default state makes the app slower because React will always rerender it?

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

[Feb 17, 2021](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/602bab9dcc91ac05270efb59#reply-602c693ab76f9808b488e902)

Hi [Edidiong Asikpo](https://hashnode.com/@didicodes), thanks for your question. Yes, the purpose of lazy initial state is to prevent subsequent re-renders of the same expensive function that you only want to run once.

Let's say you want to run this function upon render but just once:

```
const [state, setState] = useState(getInitialHundredItems())
```

The way React useState works is that even after you updated the state, the initial state function will get executed and then disregarded (replaced with updated value). So if initial state is an expensive function, it will be waste of processing power. Since all initial states will be disregarded and replaced with updated value (if exist) anyways, lazy initial state ensures that the expensive function runs only once.

[Edidiong Asikpo (Didi)](https://hashnode.com/@didicodes)

[Feb 17, 2021](https://hashnode.com/posts/a-look-at-react-hooks-usestate/602a8b0f40efdc777c71c345/comment/602bab9dcc91ac05270efb59#reply-602cd0dcd78c410f41b3e0d0)

Ah ah. This makes sense. Thanks for explaining [Victoria Lo](https://hashnode.com/@victoria)
