Skip to content

Commit

Permalink
Reduce confusion about adding additional fields to .this (reactjs#2142)
Browse files Browse the repository at this point in the history
As a new React learner, this part was a bit confusing as I though that it was referencing `() => this.tick()` part of the code. My addition would help at least people like me.
  • Loading branch information
mikkovedru authored and alexkrolick committed Jul 11, 2019
1 parent e1abbde commit 4af9f2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/docs/state-and-lifecycle.md
Expand Up @@ -244,7 +244,7 @@ The `componentDidMount()` method runs after the component output has been render
}
```

Note how we save the timer ID right on `this`.
Note how we save the timer ID right on `this` (`this.timerID`).

While `this.props` is set up by React itself and `this.state` has a special meaning, you are free to add additional fields to the class manually if you need to store something that doesn’t participate in the data flow (like a timer ID).

Expand Down

0 comments on commit 4af9f2d

Please sign in to comment.