From a1dbf7063d9c34ebc01497ec34d5ddd113284afb Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Fri, 17 Apr 2015 18:59:13 +0800 Subject: [PATCH] Deprecation notes for setProps et al --- react.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/react.md b/react.md index f69331468..5d64de0e9 100644 --- a/react.md +++ b/react.md @@ -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. {:.center} +```html + +``` +{:.light} + ```js -this.setProps({ fullscreen: true }); -this.setState({ username: 'rstacruz' }); +// props + this.props.fullscreen //=> true -this.props.fullscreen === true -this.state.username === 'rstacruz' - -this.replaceProps({ ... }); -this.replaceState({ ... }); +// state + this.setState({ username: 'rstacruz' }); + this.replaceState({ ... }); + this.state.username //=> 'rstacruz' ``` ```js @@ -85,7 +89,8 @@ These are methods available for `Component` instances. See [Component API](http: {:.center} ```js -React.findDOMNode(c) // 0.13+ +React.findDOMNode(c) // 0.13+ +c.getDOMNode() // 0.12 below ``` {:.light} @@ -97,9 +102,10 @@ c.state c.props c.setState({ ... }) -c.setProps({ ... }) c.replaceState({ ... }) -c.replaceProps({ ... }) + +c.setProps({ ... }) // for deprecation +c.replaceProps({ ... }) // for deprecation c.refs ``` @@ -355,7 +361,7 @@ var TickTock = React.createClass({ ## [Top level API](https://facebook.github.io/react/docs/top-level-api.html) ```js -React.findDOMNode(c) +React.findDOMNode(c) // 0.13+ React.createClass({ ... }) React.render(, domnode, [callback])