Format
This commit is contained in:
parent
9bddb4a537
commit
6a0a221b9c
7
react.md
7
react.md
|
@ -63,17 +63,16 @@ render: function () {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setting defaults
|
### Setting defaults
|
||||||
|
Pre-populates `this.state.comments` and `this.props.name`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
React.createClass({
|
React.createClass({
|
||||||
// Pre-populates `this.state.data`
|
|
||||||
getInitialState: function () {
|
getInitialState: function () {
|
||||||
return {data: []};
|
return { comments: [] };
|
||||||
},
|
},
|
||||||
|
|
||||||
// Pre-populates `this.props.name`
|
|
||||||
getDefaultProps: function () {
|
getDefaultProps: function () {
|
||||||
return {name: ''};
|
return { name: "Hello" };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue