Cannot read property 'setState' of null
<p>im starting ReactJS and i try to use Firebase as a database to collect my data. Im stuck from 2 days now cause of this error : "Cannot read property 'setState' of null"</p>

<p>I can read my data from Firebase but i can't display them... I don't really know what to do :</p>

<pre><code>import React from 'react';
import ProductList from '../Product/ProductList';
import Firebase from 'firebase';

class HomePage extends React.Component {
  constructor() {
    super();

    this.state = {
      productList: []
    }

    var firebaseRef = new Firebase('https://codehunt-one.firebaseio.com/');
    firebaseRef.child("products").on('value', function(snapshot) {
      var products = snapshot.val();
      console.log(products);

      this.setState({
        productList: products
      })
    });
  }

  render() {
    return (
      &lt;section&gt;
        &lt;header&gt;
          &lt;img src="img/banner.jpeg" width="100%" /&gt;
        &lt;/header&gt;

        &lt;section&gt;
          &lt;section className="container"&gt;
              {this.state.productList
                ?
                &lt;ProductList productList={this.state.productList}/&gt;
                :
                null
              }

          &lt;/section&gt;
        &lt;/section&gt;
      &lt;/section&gt;
    );
  }
}

export default HomePage;
</code></pre>