because I can not put a console.log of my state inside bcrypt.compare in native reply?

0
bcrypt.compare(guess, password, function(err, res) {
          if(res) {
            console.log(this.state.algo);
          }
        });

I can not do the console.log I'm running the app with expo, on the screen it returns Something went wrong.

    
asked by RereRoro1 27.09.2018 в 20:10
source

1 answer

0
bcrypt.compare(guess, password, function(err, res) {
      if(res) {
        console.log(this.state.algo);
      }
    });

The problem was that I had to do an arrow function.

bcrypt.compare(guess, password,(err, res)=> {
      if(res) {
        console.log(this.state.algo);
      }
    });
    
answered by 03.10.2018 в 16:06