This is my function in class:
loadFeed = () => {
    this.setState=({
        refresh: true,
        collection: []
    });
    var that = this;
    database.ref('collection').orderByChild('date').once('value').then(function(snapshot) {
        const exists = (snapshot.val() !== null);
        if(exists) data = snapshot.val();
        var temp = that.state.employees;
        for(var item in data){
            var Obj = data[photo];
            database.ref('users').child(Obj.name).once('value').then(function(snapshot){
                const exists = (snapshot.val() !== null);
                if(exists) data = snapshot.val();
                temp.push({
                    id: key,
                    name: Obj.name
                });
                that.setState({
                    refresh: false,
                    loading: false
                });
            }).catch(error => console.log(error)); 
        }
    }).catch(error => console.log(error));
}
In above code I am getting this error:
that.setState is not a function.
(In 'that.setState({ refresh: false, loading: false })', 'that.setState' is an instance of Object)
 
     
     
    