From fbccd7b3d61a63a517a059bf3cf6d65fb84d2490 Mon Sep 17 00:00:00 2001 From: Gil Chen-Zion Date: Wed, 28 Sep 2016 22:07:29 -0400 Subject: [PATCH] Note that getInitialState is not used in ES6 classes in docs (#7748) --- docs/ref-03-component-specs.it-IT.md | 4 ++++ docs/ref-03-component-specs.ko-KR.md | 4 ++++ docs/ref-03-component-specs.md | 4 ++++ docs/ref-03-component-specs.zh-CN.md | 18 +++++++++++------- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/ref-03-component-specs.it-IT.md b/docs/ref-03-component-specs.it-IT.md index efde1cbb..b2191a8c 100644 --- a/docs/ref-03-component-specs.it-IT.md +++ b/docs/ref-03-component-specs.it-IT.md @@ -37,6 +37,10 @@ object getInitialState() Invocato una volta prima che il componente venga montato. Il valore di ritorno sarà usato come il valore iniziale di `this.state`. +> Nota: +> +> Questo metodo non è disponibile il componenti `class` ES6 che estendono `React.Component`. Per maggiori informazioni, leggi la nostra documentazione sulle [classi ES6](/react/docs/reusable-components.html#es6-classes). + ### getDefaultProps diff --git a/docs/ref-03-component-specs.ko-KR.md b/docs/ref-03-component-specs.ko-KR.md index 6f8f6d03..675e3d46 100644 --- a/docs/ref-03-component-specs.ko-KR.md +++ b/docs/ref-03-component-specs.ko-KR.md @@ -37,6 +37,10 @@ object getInitialState() 컴포넌트가 마운트되기 전에 한번 호출됩니다. 리턴값은 `this.state`의 초기값으로 사용됩니다. +> 주의: +> +> 이 메소드는 `React.Component`를 확장한 ES6 `class` 컴포넌트에서는 사용할 수 없습니다. 관한 더 자세한 정보는 [ES6 클래스](/react/docs/reusable-components-ko-KR.html#es6-클래스)를 읽어보세요. + ### getDefaultProps diff --git a/docs/ref-03-component-specs.md b/docs/ref-03-component-specs.md index 6c0986bf..96be5c0e 100644 --- a/docs/ref-03-component-specs.md +++ b/docs/ref-03-component-specs.md @@ -37,6 +37,10 @@ object getInitialState() Invoked once before the component is mounted. The return value will be used as the initial value of `this.state`. +> Note: +> +> This method is not available on ES6 `class` components that extend `React.Component`. For more information, please read our documentation about [ES6 classes](/react/docs/reusable-components.html#es6-classes). + ### getDefaultProps diff --git a/docs/ref-03-component-specs.zh-CN.md b/docs/ref-03-component-specs.zh-CN.md index f1e1a174..7b570db1 100644 --- a/docs/ref-03-component-specs.zh-CN.md +++ b/docs/ref-03-component-specs.zh-CN.md @@ -11,7 +11,7 @@ next: tags-and-attributes-zh-CN.html 当调用 `React.createClass()` 创建一个组件类时,你应该提供一个包含有 `render` 方法以及可选的其他生命周期方法的 规范(Specifications)对象. > 注意: -> +> > 同样可以使用单纯的 JavaScript 类作为组件类. 这些类可以实现大多数相同的方法,虽然有一些不同.更多关于不同的信息,请阅读我们关于[ES6 classes](/react/docs/reusable-components.html#es6-classes)的文档. ### render @@ -21,22 +21,26 @@ ReactElement render() ``` `render()` 是必须的 - + 当被调用时,它应该检查 `this.props` 和 `this.state` 并返回单个子元素.这个子元素即可以是一个 对原生DOM的虚拟表达(比如 `
` 或 `React.DOM.div()`)也可以是其他你自定义的复合组件. - + 你也可以返回 `null` 或 `false` 来指示你不想要任何东西被渲染.幕后,React 渲染一个 `