title: Axios ReactJS - Cannot read property 'setState' of undefined
body: <p>I am getting an error "TypeError: Cannot read property 'setState' of undefined" while doing a simple thing in ReactJS. I am trying to use axios to fill input with response data. So far without success.
  I am very new to both axios and ReactJs so it might be something very simple I overlooked?</p>
  
  <p>I would expect "RESPONSE TEXT" to show up in the input field in the form after the TypeError is fixed.</p>
  
  <p>This is my component:</p>
  
  <pre><code>class BasicInfoBlock extends React.Component {
      constructor(props) {
          super(props);
  
          this.state = { name : "EventTestName" };
      }
  
      componentDidMount() {
          axios
          .get(getBaseUrl()+`get`)
          .then(function (response) {
              this.setState({name: "RESPONSE TEXT"});
              //this.setState({name: response.data.name});
          })
          .catch((e) =&gt; 
          {
              console.error(e);
          });
          //this.setState({});
      }
  
  
      render(){
          return(
                  &lt;form className="form-horizontal"&gt;
                      &lt;div className="form-group"&gt;
                          &lt;label htmlFor="eventName" className="col-sm-2 control-label"&gt;Name&lt;/label&gt;
                          &lt;div className="col-sm-10"&gt;
                          &lt;input type="text" id="eventName" className="form-control" placeholder="Event name" defaultValue={this.state.name}/&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              );
      }
  }
  </code></pre>
  
  <p>Thank you for your help</p>
  
  <p>edit: this is not a duplicate question, this questions relates to 'this' not being available in callback. Question selected as duplicate is related to bind.</p>