Skip to content

Commit 5a55471

Browse files
authored
docs(cn): merge reactjs.org into zh-hans @ 8f7ffa4
2 parents 4fe62ba + 6e55839 commit 5a55471

22 files changed

+359
-199
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
Note to Hacktoberfest 🎃 participants:
12

3+
While we appreciate the enthusiasm, we are experiencing a high volume of drive-by pull requests (one-line changes, README tweaks, etc.). Please remember that hundreds of people are subscribed to this repo and will receive notifications for these PRs. Spam submissions will be closed and won't count towards your Hacktoberfest goals.
24

5+
Please search for issues tagged [`good first issue`][gfi] or [`hacktoberfest`][hacktoberfest] to find things to work on.
6+
7+
You can also search [all of GitHub][all].
8+
9+
[gfi]: https://github.com/reactjs/reactjs.org/issues?q=is%3Aissue+is%3Aopen+label%3A"good+first+issue"
10+
[hacktoberfest]: https://github.com/reactjs/reactjs.org/issues?q=is%3Aissue+is%3Aopen+label%3A"good+first+issue"
11+
[all]: https://github.com/search?q=is%3Aissue+hacktoberfest
312
<!--
413
514
Thank you for the PR! Contributors like you keep React awesome!

content/community/conferences.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c
1212

1313
## Upcoming Conferences {#upcoming-conferences}
1414

15-
### React Native EU 2020 {#react-native-eu-2020}
16-
September 3-4, 2020 - remote event
17-
18-
[Website](https://www.react-native.eu/) - [Twitter](https://twitter.com/react_native_eu) - [Facebook](https://www.facebook.com/reactnativeeu/) - [YouTube](https://www.youtube.com/watch?v=m0GfmlGFh3E&list=PLZ3MwD-soTTHy9_88QPLF8DEJkvoB5Tl-) - [Instagram](https://www.instagram.com/reactnative_eu/)
19-
20-
### render(ATL) 2020 {#render-atlanta-2020}
21-
September 13-15, 2020. Atlanta, GA, USA.
22-
23-
[Website](https://renderatl.com) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl)
24-
2515
### React Summit 2020 {#react-summit-2020}
26-
7am PST / 1pm EST / 4pm CEST October 15-16, 2020 - remote event
16+
October 15-16, 2020, 7am PST / 10am EST / 4pm CEST - remote event
2717

2818
[Website](https://reactsummit.com) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://youtube.com/c/ReactConferences)
2919

30-
### React Day Berlin 2020 {#react-day-berlin-2020}
31-
November 25-27, 2020 in Berlin, Germany
20+
### React Conf Brasil 2020 {#react-conf-brasil-2020}
21+
November 21, 2020 - remote event
3222

33-
[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://www.youtube.com/reactdayberlin)
23+
[Website](https://reactconf.com.br/) - [Twitter](https://twitter.com/reactconfbr) - [Slack](https://react.now.sh/)
3424

3525
### React Next 2020 {#react-next-2020}
36-
December 1, 2020. Tel Aviv, Israel.
26+
December 1-2, 2020 - remote event
3727

3828
[Website](https://react-next.com/) - [Twitter](https://twitter.com/reactnext) - [Facebook](https://www.facebook.com/ReactNext2016/)
3929

30+
### render(ATL) 2021 {#render-atlanta-2021}
31+
September 13-15, 2021. Atlanta, GA, USA
32+
33+
[Website](https://renderatl.com) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl)
34+
35+
### React India 2021 {#react-india-2021}
36+
November 12-13, 2021 in Mumbai, India
37+
38+
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia/) - [LinkedIn](https://www.linkedin.com/showcase/14545585) - [YouTube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w/videos) [Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia/) - [LinkedIn](https://www.linkedin.com/showcase/14545585) - [YouTube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w/videos)
39+
4040
## Past Conferences {#past-conferences}
4141

4242
### React.js Conf 2015 {#reactjs-conf-2015}
@@ -470,3 +470,8 @@ May 1, 2020. Streamed online on YouTube.
470470
May 14-15, 2020 in Paris, France
471471

472472
[Website](https://www.react-europe.org) - [Twitter](https://twitter.com/ReactEurope) - [Facebook](https://www.facebook.com/ReactEurope) - [Videos](https://www.youtube.com/c/ReacteuropeOrgConf)
473+
474+
### React Native EU 2020 {#react-native-eu-2020}
475+
September 3-4, 2020 - remote event
476+
477+
[Website](https://www.react-native.eu/) - [Twitter](https://twitter.com/react_native_eu) - [Facebook](https://www.facebook.com/reactnativeeu/) - [YouTube](https://www.youtube.com/watch?v=m0GfmlGFh3E&list=PLZ3MwD-soTTHy9_88QPLF8DEJkvoB5Tl-) - [Instagram](https://www.instagram.com/reactnative_eu/)

content/community/meetups.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
4848
* [Beijing](https://www.meetup.com/Beijing-ReactJS-Meetup/)
4949

5050
## Colombia {#colombia}
51+
* [Bogotá](https://www.meetup.com/meetup-group-iHIeHykY/)
5152
* [Medellin](https://www.meetup.com/React-Medellin/)
53+
* [Cali](https://www.meetup.com/reactcali/)
5254

5355
## Denmark {#denmark}
5456
* [Aalborg](https://www.meetup.com/Aalborg-React-React-Native-Meetup/)
@@ -147,7 +149,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
147149
* [Zurich](https://www.meetup.com/Zurich-ReactJS-Meetup/)
148150

149151
## Turkey {#turkey}
150-
* [Istanbul](https://www.meetup.com/ReactJS-Istanbul/)
152+
* [Istanbul](https://kommunity.com/reactjs-istanbul)
151153

152154
## Ukraine {#ukraine}
153155
* [Kyiv](https://www.meetup.com/Kyiv-ReactJS-Meetup)
@@ -164,6 +166,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
164166
* [Cleveland, OH - ReactJS](https://www.meetup.com/Cleveland-React/)
165167
* [Columbus, OH - ReactJS](https://www.meetup.com/ReactJS-Columbus-meetup/)
166168
* [Dallas, TX - ReactJS](https://www.meetup.com/ReactDallas/)
169+
* [Dallas, TX - [Remote] React JS](https://www.meetup.com/React-JS-Group/)
167170
* [Detroit, MI - Detroit React User Group](https://www.meetup.com/Detroit-React-User-Group/)
168171
* [Irvine, CA - ReactJS](https://www.meetup.com/ReactJS-OC/)
169172
* [Kansas City, MO - ReactJS](https://www.meetup.com/Kansas-City-React-Meetup/)

content/community/podcasts.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Podcasts dedicated to React and individual podcast episodes with React discussio
1818

1919
- [React Native Radio](https://devchat.tv/react-native-radio)
2020

21+
- [React Wednesdays](https://www.telerik.com/react-wednesdays) - Weekly live streams with the best and brightest in the React world
22+
2123
## Episodes {#episodes}
2224

2325
- [CodeWinds Episode 4](https://codewinds.com/podcast/004.html) - Pete Hunt talks with Jeff Barczewski about React.

content/docs/addons-animation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class TodoList extends React.Component {
5050
5151
render() {
5252
const items = this.state.items.map((item, i) => (
53-
<div key={item} onClick={() => this.handleRemove(i)}>
53+
<div key={i} onClick={() => this.handleRemove(i)}>
5454
{item}
5555
</div>
5656
));

content/docs/code-splitting.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ import("./math").then(math => {
7575
});
7676
```
7777

78-
当 Webpack 解析到该语法时,会自动进行代码分割。如果你使用 Create React App,该功能已开箱即用,你可以[立刻使用](https://facebook.github.io/create-react-app/docs/code-splitting)该特性。[Next.js](https://nextjs.org/docs/advanced-features/dynamic-import) 也已支持该特性而无需进行配置。
78+
当 Webpack 解析到该语法时,会自动进行代码分割。
79+
如果你使用 Create React App,该功能已开箱即用,
80+
你可以[立刻使用](https://create-react-app.dev/docs/code-splitting/)该特性。
81+
[Next.js](https://nextjs.org/docs/advanced-features/dynamic-import) 也已支持该特性而无需进行配置。
7982

8083
如果你自己配置 Webpack,你可能要阅读下 Webpack 关于[代码分割](https://webpack.docschina.org/guides/code-splitting/)的指南。你的 Webpack 配置应该[类似于此](https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269)
8184

82-
当使用 [Babel](https://babel.docschina.org/) 时,你要确保 Babel 能够解析动态 import 语法而不是将其进行转换。对于这一要求你需要 [babel-plugin-syntax-dynamic-import](https://yarnpkg.com/en/package/babel-plugin-syntax-dynamic-import) 插件。
85+
当使用 [Babel](https://babeljs.io/) 时,你要确保 Babel 能够解析动态 import 语法而不是将其进行转换。对于这一要求你需要 [@babel/plugin-syntax-dynamic-import](https://classic.yarnpkg.com/en/package/@babel/plugin-syntax-dynamic-import) 插件。
8386

8487
## `React.lazy` {#reactlazy}
8588

content/docs/conditional-rendering.md

+13
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ ReactDOM.render(
152152

153153
因此,如果条件是 `true``&&` 右侧的元素就会被渲染,如果是 `false`,React 会忽略并跳过它。
154154

155+
请注意,返回 false 的表达式会使 `&&` 后面的元素被跳过,但会返回 false 表达式。在下面示例中,render 方法的返回值是 `<div>0</div>`
156+
157+
```javascript{2,5}
158+
render() {
159+
const count = 0;
160+
return (
161+
<div>
162+
{ count && <h1>Messages: {count}</h1>}
163+
</div>
164+
);
165+
}
166+
```
167+
155168
### 三目运算符 {#inline-if-else-with-conditional-operator}
156169

157170
另一种内联条件渲染的方法是使用 JavaScript 中的三目运算符 [`condition ? true : false`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Conditional_Operator)

content/docs/faq-functions.md

-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ const A = 65 // ASCII character code
152152
class Alphabet extends React.Component {
153153
constructor(props) {
154154
super(props);
155-
this.handleClick = this.handleClick.bind(this);
156155
this.state = {
157156
justClicked: null,
158157
letters: Array.from({length: 26}, (_, i) => String.fromCharCode(A + i))

content/docs/reference-profiler.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ render(
4848
);
4949
```
5050

51-
嵌套使用 `Profiler` 组件来测量相同一个子树下的不同组件。
52-
```js{2,6,8}
51+
嵌套使用 `Profiler` 组件来测量相同一个子树下的不同组件:
52+
53+
```js{3,5,8}
5354
render(
5455
<App>
5556
<Profiler id="Panel" onRender={callback}>

content/docs/reference-react-component.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Welcome extends React.Component {
3939
4040
### 组件的生命周期 {#the-component-lifecycle}
4141

42-
每个组件都包含“生命周期方法”,你可以重写这些方法,以便于在运行过程中特定的阶段执行这些方法。**你可以使用此[生命周期图谱](http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)作为速查表**。在下述列表中,常用的生命周期方法会被加粗。其余生命周期函数的使用则相对罕见。
42+
每个组件都包含 “生命周期方法”,你可以重写这些方法,以便于在运行过程中特定的阶段执行这些方法。**你可以使用此[生命周期图谱](https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)作为速查表**。在下述列表中,常用的生命周期方法会被加粗。其余生命周期函数的使用则相对罕见。
4343

4444
#### 挂载 {#mounting}
4545

@@ -109,7 +109,7 @@ class Welcome extends React.Component {
109109

110110
### 常用的生命周期方法 {#commonly-used-lifecycle-methods}
111111

112-
本节中的方法涵盖了创建 React 组件时能遇到的绝大多数用例。**想要更好了解这些方法,可以参考[生命周期图谱](http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)**
112+
本节中的方法涵盖了创建 React 组件时能遇到的绝大多数用例。**想要更好了解这些方法,可以参考[生命周期图谱](https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)**
113113

114114
### `render()` {#render}
115115

@@ -245,7 +245,7 @@ componentWillUnmount()
245245

246246
### 不常用的生命周期方法 {#rarely-used-lifecycle-methods}
247247

248-
本节中的生命周期方法并不太常用。它们偶尔会很方便,但是大部分情况下组件可能都不需要它们。你可以在[生命周期图谱](http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)中,选择“显示不常用的生命周期”复选框,即可看到下述相关方法。
248+
本节中的生命周期方法并不太常用。它们偶尔会很方便,但是大部分情况下组件可能都不需要它们。你可以在[生命周期图谱](https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)中,选择“显示不常用的生命周期”复选框,即可看到下述相关方法。
249249

250250

251251
### `shouldComponentUpdate()` {#shouldcomponentupdate}
@@ -324,7 +324,7 @@ getSnapshotBeforeUpdate(prevProps, prevState)
324324
欲了解更多详细信息,请参阅 [*React 16 中的错误处理*](/blog/2017/07/26/error-handling-in-react-16.html)
325325

326326
> 注意
327-
>
327+
>
328328
> Error boundaries 仅捕获组件树中**以下**组件中的错误。但它本身的错误无法捕获。
329329
330330
### `static getDerivedStateFromError()` {#static-getderivedstatefromerror}
@@ -353,7 +353,7 @@ class ErrorBoundary extends React.Component {
353353
return <h1>Something went wrong.</h1>;
354354
}
355355
356-
return this.props.children;
356+
return this.props.children;
357357
}
358358
}
359359
```
@@ -408,13 +408,13 @@ class ErrorBoundary extends React.Component {
408408
return <h1>Something went wrong.</h1>;
409409
}
410410
411-
return this.props.children;
411+
return this.props.children;
412412
}
413413
}
414414
```
415415

416416
> 注意
417-
>
417+
>
418418
> 如果发生错误,你可以通过调用 `setState` 使用 `componentDidCatch()` 渲染降级 UI,但在未来的版本中将不推荐这样做。
419419
> 可以使用静态 `getDerivedStateFromError()` 来处理降级渲染。
420420

gatsby-browser.js

-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
const React = require('react');
1010
const ReactDOM = require('react-dom');
11-
const {BannerContextManager} = require('components/Banner');
1211

1312
// Import global styles
1413
require('normalize.css');
@@ -23,7 +22,3 @@ window.ReactDOM = ReactDOM;
2322
// A stub function is needed because gatsby won't load this file otherwise
2423
// (https://github.com/gatsbyjs/gatsby/issues/6759)
2524
exports.onClientEntry = () => {};
26-
27-
exports.wrapRootElement = ({element}) => (
28-
<BannerContextManager>{element}</BannerContextManager>
29-
);

0 commit comments

Comments
 (0)