Deprecation notes for setProps et al

This commit is contained in:
Rico Sta. Cruz 2015-04-17 18:59:13 +08:00
parent 5e91475913
commit a1dbf7063d
1 changed files with 17 additions and 11 deletions

View File

@ -45,15 +45,19 @@ Use [props](https://facebook.github.io/react/docs/tutorial.html#using-props) (`t
Use [states](https://facebook.github.io/react/docs/tutorial.html#reactive-state) (`this.state`) to manage dynamic data. Use [states](https://facebook.github.io/react/docs/tutorial.html#reactive-state) (`this.state`) to manage dynamic data.
{:.center} {:.center}
```html
<MyComponent fullscreen={true} />
```
{:.light}
```js ```js
this.setProps({ fullscreen: true }); // props
this.props.fullscreen //=> true
// state
this.setState({ username: 'rstacruz' }); this.setState({ username: 'rstacruz' });
this.props.fullscreen === true
this.state.username === 'rstacruz'
this.replaceProps({ ... });
this.replaceState({ ... }); this.replaceState({ ... });
this.state.username //=> 'rstacruz'
``` ```
```js ```js
@ -86,6 +90,7 @@ These are methods available for `Component` instances. See [Component API](http:
```js ```js
React.findDOMNode(c) // 0.13+ React.findDOMNode(c) // 0.13+
c.getDOMNode() // 0.12 below
``` ```
{:.light} {:.light}
@ -97,9 +102,10 @@ c.state
c.props c.props
c.setState({ ... }) c.setState({ ... })
c.setProps({ ... })
c.replaceState({ ... }) c.replaceState({ ... })
c.replaceProps({ ... })
c.setProps({ ... }) // for deprecation
c.replaceProps({ ... }) // for deprecation
c.refs c.refs
``` ```
@ -355,7 +361,7 @@ var TickTock = React.createClass({
## [Top level API](https://facebook.github.io/react/docs/top-level-api.html) ## [Top level API](https://facebook.github.io/react/docs/top-level-api.html)
```js ```js
React.findDOMNode(c) React.findDOMNode(c) // 0.13+
React.createClass({ ... }) React.createClass({ ... })
React.render(<Component />, domnode, [callback]) React.render(<Component />, domnode, [callback])