Clarify purpose of state property in ES6 classes (#7109)
Brandon Dail committed
Jun 23, 2016 at 14:44 UTC
60760eb915d699eab0e688effbb4134698f81624
1 file changed
+1
-1
docs/docs/05-reusable-components.md
+1
-1
@@ -213,7 +213,7 @@ class HelloMessage extends React.Component {
213
ReactDOM.render(<HelloMessage name="Sebastian" />, mountNode);
214
```
215
216
-The API is similar to `React.createClass` with the exception of `getInitialState`. Instead of providing a separate `getInitialState` method, you set up your own `state` property in the constructor.
216
+The API is similar to `React.createClass` with the exception of `getInitialState`. Instead of providing a separate `getInitialState` method, you set up your own `state` property in the constructor. Just like the return value of `getInitialState`, the value you assign to `this.state` will be used as the initial state for your component.
217
218
Another difference is that `propTypes` and `defaultProps` are defined as properties on the constructor instead of in the class body.
219