mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 11:52:00 +00:00
Added missing comma and removed a few redundant words (#3725)
This commit is contained in:
@@ -9,7 +9,7 @@ redirect_from:
|
||||
- "docs/forms-zh-CN.html"
|
||||
---
|
||||
|
||||
HTML form elements work a little bit differently from other DOM elements in React, because form elements naturally keep some internal state. For example, this form in plain HTML accepts a single name:
|
||||
HTML form elements work a bit differently from other DOM elements in React, because form elements naturally keep some internal state. For example, this form in plain HTML accepts a single name:
|
||||
|
||||
```html
|
||||
<form>
|
||||
|
||||
@@ -40,7 +40,7 @@ React is a JavaScript library, and so we'll assume you have a basic understandin
|
||||
|
||||
>Note
|
||||
>
|
||||
>This guide occasionally uses some of the newer JavaScript syntax in the examples. If you haven't worked with JavaScript in the last few years, [these three points](https://gist.github.com/gaearon/683e676101005de0add59e8bb345340c) should get you most of the way.
|
||||
>This guide occasionally uses some newer JavaScript syntax in the examples. If you haven't worked with JavaScript in the last few years, [these three points](https://gist.github.com/gaearon/683e676101005de0add59e8bb345340c) should get you most of the way.
|
||||
|
||||
|
||||
## Let's Get Started! {#lets-get-started}
|
||||
|
||||
@@ -207,7 +207,7 @@ A good rule of thumb is that elements inside the `map()` call need keys.
|
||||
|
||||
### Keys Must Only Be Unique Among Siblings {#keys-must-only-be-unique-among-siblings}
|
||||
|
||||
Keys used within arrays should be unique among their siblings. However they don't need to be globally unique. We can use the same keys when we produce two different arrays:
|
||||
Keys used within arrays should be unique among their siblings. However, they don't need to be globally unique. We can use the same keys when we produce two different arrays:
|
||||
|
||||
```js{2,5,11,12,19,21}
|
||||
function Blog(props) {
|
||||
|
||||
@@ -84,7 +84,7 @@ To make your UI interactive, you need to be able to trigger changes to your unde
|
||||
|
||||
To build your app correctly, you first need to think of the minimal set of mutable state that your app needs. The key here is [DRY: *Don't Repeat Yourself*](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself). Figure out the absolute minimal representation of the state your application needs and compute everything else you need on-demand. For example, if you're building a TODO list, keep an array of the TODO items around; don't keep a separate state variable for the count. Instead, when you want to render the TODO count, take the length of the TODO items array.
|
||||
|
||||
Think of all of the pieces of data in our example application. We have:
|
||||
Think of all the pieces of data in our example application. We have:
|
||||
|
||||
* The original list of products
|
||||
* The search text the user has entered
|
||||
|
||||
Reference in New Issue
Block a user