[SOLVED] self.$setState is not a function


#1

Hello team,

I am faced with an issue where I cant think of an alternative…

   onWatchLocationSuccess: function(position) {

      var updatedLatitude = position.coords.latitude;
      var updatedLongitude = position.coords.longitude;

      if (updatedLatitude !== self.Latitude && updatedLongitude !== self.Longitude) {
          
     self.$setState({
        Latitude: updatedLatitude,
      });

     self.$setState({
        Longitude: updatedLongitude,
      });

        self.remainingTimeAndDistance(updatedLatitude, updatedLongitude);
      }
  },

I keep getting a message in the console…

Capture2

I used this and it works else where… I just cant understand why it is failing here… Thanks in advance…


#2

Sorry guys, I didnt define 'self'… so sorry