Skip to content

Commit 0feafe0

Browse files
Update intro-react.md (facebook#4546)
Co-authored-by: Riccardo Cipolleschi <riccardo.cipolleschi@gmail.com>
1 parent 64d76b0 commit 0feafe0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

docs/intro-react.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ Now, when someone presses the button, `onPress` will fire, calling the `setIsHun
460460
```
461461

462462
:::info
463-
You might’ve noticed that although `isHungry` is a [const](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/const), it is seemingly reassignable! What is happening is when a state-setting function like `setIsHungry` is called, its component will re-render. In this case the `Cat` function will run again—and this time, `useState` will give us the next value of `isHungry`.
463+
You might’ve noticed that although `isHungry` is a [const](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/const), it is seemingly reassignable! The `const` keyword here does not mean that the state itself is immutable. Rather, it means that the reference to the object, that contains the state and the function to update it, will not change.
464+
What is happening is when a state-setting function like `setIsHungry` is called, its component will re-render. In this case the `Cat` function will run again—and this time, `useState` will give us the next value of `isHungry`.
464465
:::
465466

466467
Finally, put your cats inside a `Cafe` component:

0 commit comments

Comments
 (0)