title: Can't setState Firestore data
body: <p>I'm working on a React project with Cloud Firestore. I have successfully fetched data from Firestore. But I could not set state these data to state. </p>
  
  <p>How can I set state these data.</p>
  
  <pre><code>class App extends Component {
    constructor(props) {
      super(props);
      this.state = {
        items: []
      };
    }
  
    async componentDidMount() {
      const items = [];
  
      firebase
        .firestore()
        .collection("items")
        .get()
        .then(function(querySnapshot) {
          querySnapshot.forEach(function(doc) {
            items.push(doc.data());
          });
        });
  
      this.setState({ items: items });
    }
  
    render() {
      const items = this.state.items;
      console.log("items", items);
  
      return (
        &lt;div&gt;
          &lt;div&gt;
            &lt;ul&gt;
              {items.map(item =&gt; (
                &lt;li&gt;
                  &lt;span&gt;{item.name}()&lt;/span&gt;
                &lt;/li&gt;
              ))}
            &lt;/ul&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default App;
  </code></pre>