title: Axios code not running after `.then`
body: <p>I am new to react/nodejs/express/javascript and have encountered the following problem:</p>
  
  <p>I want to get a number, then post that number + 1, then I want to create a new js object using that number(<code>newFreshId</code>) and I want to add it to add that event to my <code>schedulerData</code>. When I try running the code, I can get and post to <code>/api/num</code>, but I everything after the <code>.then(function(response) {</code> doesnt appear to run. </p>
  
  <p>I wanted to do this sequentially, so I used <code>.then</code> after every task so that I would not have encountered a problem.</p>
  
  <p>I also tried to remove all the <code>.then</code>s in favor of a while loop that waits for the value to change. This also did not work. </p>
  
  <p>CODE:</p>
  
  <p>CLIENT:</p>
  
  <pre><code>this.newEvent = (schedulerData, slotId, slotName, start, end, type, item) =&gt; {
      let newFreshId = 0;
      let newEvent = {}
      axios.get("/api/num").then(function(response) {
          newFreshId = response.data[0] + 1;
  
          // console.log(newFreshId);
      }).then(function() {
          axios.post("/api/num", {
              id: newFreshId
          }).then(function(response) {
              console.log(response)
              // handle success
              newEvent = {
                  id: newFreshId,
                  title: this.state.title,
                  start: start,
                  end: end,
                  resourceId: slotId
              };
              schedulerData.addEvent(newEvent);
              this.setState({
                  viewModel: schedulerData
              });
  
              // while(JSON.stringify(newEvent) === '{}'){
              //   console.log('waiting')
              // }
  
              console.log(newEvent)
              schedulerData.addEvent(newEvent);
  
              console.log(newEvent)
              this.setState({
                  viewModel: schedulerData
              });
          })
      })
  };
  </code></pre>
  
  <p>SERVER: </p>
  
  <pre><code>app.get('/api/num', function(req, res) {
      //console.log(require('./number.json'))
      var fs  = require('fs')
      fs.readFile('./number.json', {encoding:   'utf-8'}, function(err,data){
      if (!err) {
          //console.log('received data: ' + JSON.parse(data));
          res.json(JSON.parse(data))
      } else {
          console.log(err);
      }})
  })
  
  app.post('/api/num', function(req, res) {
      var id = req.body.id
      var fs = require('fs');
  
      fs.writeFileSync("./number.json", "[ "+id+" ]", function(err) {
          if(err) {
              return console.log(err);
          }
          res.status(200)
      })
  })
  </code></pre>
  
  <p>Thanks for all the help :)</p>