Format
This commit is contained in:
parent
9bddb4a537
commit
6a0a221b9c
7
react.md
7
react.md
|
@ -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" };
|
||||
}
|
||||
);
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue