Mình đang học React, trong khi code một trang nhận diện gương mặt dùng clarifai thì gặp lỗi như sau, mình làm theo như Document https://www.clarifai.com/models/face-detection-image-recognition-model-a403429f2ddf4b49b307e318f00e528b-detection
Đây là đoạn code theo document của mình:
app.models.predict(Clarifai.FACE_DETECT_MODEL, this.state.input).then(
function(response) {
this.displayFaceBox(this.calculateFaceLocation(response));
},
function(err) {
console.log(err);
}
);
thì bị gặp lỗi nhưng khi chuyển sang viết ES6 thì lại chạy ok:
app.models
.predict(Clarifai.FACE_DETECT_MODEL, this.state.input)
.then(response => this.displayFaceBox(this.calculateFaceLocation(response)))
.catch(err => console.log(err));
Ai biết lý do giải thích cho mình với. Mình xin cảm ơn nhiều