title: My props are valued undefined under ComponentDidMount method in React
body: <p>Why my values under <code>this.props</code> and <code>this.state</code> are undefined in my <code>componentDidMount</code> method? In other parts of my class component I can access my props and state values correctly. Do I need to pass them separately to somewhere or where have I made any mistakes?</p>
  <p>There I get no values:</p>
  <pre><code>componentDidMount() {
      console.log(this.props.token)
      console.log(this.state.training.coach)
      // values are null and undefined.
      if (this.props.token == this.state.training.coach) {
          this.setState({
              iscreator: true
          });
          console.log(this.state.iscreator)
      } else {
          this.setState({
              iscreator: false
          });
      }
  }
  </code></pre>
  <p>There I get correct values when accessing <code>this.props.token</code>:</p>
  <pre><code>handleDelete = (event) =&gt; {
      if (this.props.token !== null) {
          const trainingID = this.props.match.params.trainingID;
          axios.defaults.headers = {
                  &quot;Content-Type&quot;: &quot;application/json&quot;,
                  Authorization: this.props.token
              }
          axios.delete(`http://127.0.0.1:8000/api/${trainingID}/`)
          this.props.history.push('/');
          this.forceUpdate();
      } else {
      
      }
  }
  </code></pre>