mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): clarify state variable naming in Toggle Text (#61277)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -7,13 +7,13 @@ dashedName: step-4
|
||||
|
||||
# --description--
|
||||
|
||||
In the prior lecture videos, you learned how to create state variables by using the `useState` hook like this:
|
||||
In the prior lectures, you learned how to create state variables by using the `useState` hook and array destructuring:
|
||||
|
||||
```js
|
||||
const [user, setUser] = useState("Jessica");
|
||||
```
|
||||
|
||||
The convention for naming state variables is to use the `[example, setExample]` format, utilizing array destructuring.
|
||||
The convention for naming state variables is to use the `example` and `setExample` format.
|
||||
|
||||
`useState` returns an array of two values. The first value is the current state. The second value is the set function that will be used to update state.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user