title: Cannot read property 'setState' of undefined
body: <p>I'm trying to use flickr api to fetch public photos and create an image carousel with them but seems it does not want to get photos in the beginning. Since I'm new to React, it is really hard to figure out what I'm doing wrong here so any kinda help will be appreciated.. Thank you.</p>
  
  <pre><code>import React, { Component } from 'react';
  import ReactDOM from 'react-dom';
  import axios from 'axios';
  import _ from 'lodash';
  
  import Button from './components/button';
  
  const urlArr = [];
  const apiKey = "YOUR_API";
  const userId = "YOUR_ID";
  const url = `https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&amp;api_key=${apiKey}&amp;user_id=${userId}&amp;format=json&amp;nojsoncallback=1`;
  
  
  class App extends Component {
    constructor(props) {
      super(props);
  
      this.state = { urlArr: [] };
  
      axios.get(url)
      .then(function(photoData) {
        _.forEach(photoData.data.photos.photo, (photo) =&gt; {
          // this.setState({ urlArr: `https://farm6.staticflickr.com//${photo.server}//${photo.id}_${photo.secret}_z.jpg` });
          urlArr.push(`https://farm6.staticflickr.com//${photo.server}//${photo.id}_${photo.secret}_z.jpg`);
        });
        this.setState({ urlArr });
      });
    }
  
    render() {
      return (
        &lt;div&gt;
          &lt;Button /&gt;
        &lt;/div&gt;
      );
    }
  };
  
  ReactDOM.render(&lt;App/&gt;, document.querySelector('.container'));
  </code></pre>
  
  <p>Code above returns 'TypeError: Cannot read property 'setState' of undefined' and I'm not quite sure what that means..</p>