We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e99b2a commit 41ac073Copy full SHA for 41ac073
demo3/demo3.jsx
@@ -37,6 +37,11 @@ var Timer = React.createClass({
37
// merged with the current state; we can use `replaceState` instead
38
// if we don't want to merge.
39
tick: function() {
40
+ // Note that React auto-binds all top-level methods in the
41
+ // object passed to `createClass` to the component instance.
42
+ // Because of this, `this` inside the `tick` method is
43
+ // automatically the component instance, and we didn't have
44
+ // to use `this.tick.bind(this)` inside the `setInterval` call.
45
this.setState({time: this.state.time + 1});
46
},
47
0 commit comments