title: running functions one after other in react
body: <p>after <code>setState</code>, i want to call <code>service.logout()</code>, then <code>Auth.logout()</code> function, </p>
  
  <pre><code> componentWillMount() {
      if (!(this.Auth.loggedIn())){
        this.props.history.replace('/login');
      } else {
        this.setState({token : this.Auth.getToken()}).then(service.logout(this.state.token)).then( this.Auth.logout())
        // console.log('token',this.state.token)
  
      }
    }
  </code></pre>
  
  <p>but im getting <code>error</code> like this,</p>
  
  <pre><code> TypeError: Cannot read property 'then' of undefined
  Logout.componentWillMount
  src/components/auth/Logout.js:20
    17 | if (!(this.Auth.loggedIn())){
    18 |   this.props.history.replace('/login');
    19 | } else {
  &gt; 20 |   this.setState({token : this.Auth.getToken()}).then(service.logout(this.state.token)).then( this.Auth.logout())
    21 |   // console.log('token',this.state.token)
    22 |  
    23 | }
  </code></pre>