Browse Source

Reduce confusion about adding additional fields to .this (#2142)

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.
main
Mikko Vedru 6 years ago
committed by Alex Krolick
parent
commit
4af9f2dcd1
  1. 2
      content/docs/state-and-lifecycle.md

2
content/docs/state-and-lifecycle.md

@ -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). 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).

Loading…
Cancel
Save