---
title: "Comment by Phillip Ninan on \"Hooks in React\" | Hashnode"
description: "Very good read! I am pretty new to react. I was a little confused on the first couple of lines. const [ number , setNumber] = useState( 0 ); Were number and set"
url: "https://hashnode.com/posts/hooks-in-react/60941cbda7a3827bb64ce418/comment/6094b932d1bbc47b91a678da"
---

[Discussion](https://hashnode.com/posts/hooks-in-react/60941cbda7a3827bb64ce418)

Comment [Hooks in React](https://hashnode.com/posts/hooks-in-react/60941cbda7a3827bb64ce418)

[May 7, 2021](https://hashnode.com/posts/hooks-in-react/60941cbda7a3827bb64ce418/comment/6094b932d1bbc47b91a678da)

Very good read! I am pretty new to react. I was a little confused on the first couple of lines.

```
const [number, setNumber] = useState(0);
```

Were `number` and `setNumber` defined someplace?

Why do you pass `0` to `useState`? Then you pass `true` to it here?

```
const [isEven, toggleEven] = useState(true);
```

I look forward to reading more!

[Deepansh Bhargava](https://hashnode.com/@deepansh)

[May 7, 2021](https://hashnode.com/posts/hooks-in-react/60941cbda7a3827bb64ce418/comment/6094b932d1bbc47b91a678da#reply-6094d3abd1bbc47b91a67ae0)

Thanks for pointing this out.

1.  So the `useState` hook returns an array consisting of two elements, and we can name these variables as per our need.
    
2.  The 0 passed in the `useState` is the initial value of the state variable. I wanted to set the value of `number` as 0 and as it is even so I have set the value of `isEven` as `true`.
    

[Phillip Ninan](https://hashnode.com/@phillip_ninan)

[May 7, 2021](https://hashnode.com/posts/hooks-in-react/60941cbda7a3827bb64ce418/comment/6094b932d1bbc47b91a678da#reply-6095463ff7929f0c6e37ca11)

[Deepansh Bhargava](https://hashnode.com/@deepansh)

Ah, that makes sense! Thank you for clearing that up for me Deepansh!
