Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(tw): translate state-and-lifecycle #16

Merged
merged 2 commits into from
Feb 20, 2019
Merged

docs(tw): translate state-and-lifecycle #16

merged 2 commits into from
Feb 20, 2019

Conversation

neighborhood999
Copy link
Member

This tech terms I keep the original:

  • local state
  • destroy
  • merge
  • shallow

@netlify
Copy link

netlify bot commented Feb 19, 2019

Deploy preview for zh-hant-reactjs ready!

Built with commit ad67e2f

https://deploy-preview-16--zh-hant-reactjs.netlify.com

@neighborhood999 neighborhood999 self-assigned this Feb 19, 2019
Copy link
Member

@chloewlin chloewlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @neighborhood999 I think this is 99% done! You missed a few lines but those can be fixed in 3 minutes. I will merge this in as soon as they're fixed. Thank you!


For example, this code may fail to update the counter:
例如,這個程式碼可能無法更新 counter

```js
// Wrong
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 錯誤

@@ -355,7 +355,7 @@ this.setState({
});
```

To fix it, use a second form of `setState()` that accepts a function rather than an object. That function will receive the previous state as the first argument, and the props at the time the update is applied as the second argument:
要修正這個問題,使用第二種形式的 `setState()`,它接受一個 function 而不是一個 object。Function 將接收先前的 state 作為第一個參數,並且將更新的 props 作為第二個參數:

```js
// Correct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line 361

@@ -364,7 +364,7 @@ this.setState((state, props) => ({
}));
```

We used an [arrow function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions) above, but it also works with regular functions:
在上面我們使用 [arrow function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions),但它也可以適用於正常的 function:

```js
// Correct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line 370


For example, this will not re-render a component:
例如,這將不會重新 render component

```js
// Wrong
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line 330


```js
// Wrong
this.state.comment = 'Hello';
```

Instead, use `setState()`:
相反的,使用 `setState()`

```js
// Correct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line 337

@chloewlin chloewlin added In Review Currently under review and removed Review Needed labels Feb 19, 2019
@neighborhood999
Copy link
Member Author

@chloewlin Thank you for reviewing. In the above some terms we should check need translate or not.

@chloewlin
Copy link
Member

@neighborhood999 no problem. Let me merge this in and we can open another discussion on individual terms.

@chloewlin chloewlin merged commit 6727c7f into reactjs:master Feb 20, 2019
@chloewlin chloewlin mentioned this pull request Feb 20, 2019
@neighborhood999 neighborhood999 added Completed and removed In Review Currently under review labels Feb 20, 2019
@neighborhood999 neighborhood999 deleted the state-and-lifecycle branch February 20, 2019 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants