Browse Source

Clarify a code snippet is incomplete (#5888)

* matched the curly braces #issues5887

Added matched the curly braces on the official website tutorial. #issues5887

* Update index.md

---------

Co-authored-by: dan <dan.abramov@gmail.com>
main
Pradeep Thakur 2 years ago
committed by GitHub
parent
commit
f681f76698
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/content/learn/index.md

1
src/content/learn/index.md

@ -313,6 +313,7 @@ Now you can declare a *state variable* inside your component:
```js ```js
function MyButton() { function MyButton() {
const [count, setCount] = useState(0); const [count, setCount] = useState(0);
// ...
``` ```
You’ll get two things from `useState`: the current state (`count`), and the function that lets you update it (`setCount`). You can give them any names, but the convention is to write `[something, setSomething]`. You’ll get two things from `useState`: the current state (`count`), and the function that lets you update it (`setCount`). You can give them any names, but the convention is to write `[something, setSomething]`.

Loading…
Cancel
Save