This commit is contained in:
Rico Sta. Cruz
2015-04-17 18:44:26 +08:00
parent 9bddb4a537
commit 6a0a221b9c
+3 -4
View File
@@ -63,17 +63,16 @@ render: function () {
```
### Setting defaults
Pre-populates `this.state.comments` and `this.props.name`.
```js
React.createClass({
// Pre-populates `this.state.data`
getInitialState: function () {
return {data: []};
return { comments: [] };
},
// Pre-populates `this.props.name`
getDefaultProps: function () {
return {name: ''};
return { name: "Hello" };
}
);
```