question = {
quest : "How old am I?",
answers : [17,18,20,25],
correct : 17,
}
checkAnswer(){
var usersAnswer = document.getElementById('ans-1').textContent;
var answer = this.question.correct;
if(usersAnswer==answer){
alert('correct')
}else{
alert('u lost')
}
}
With this code, i can't access object from event handler in ReactJS. I get this error :
TypeError: Cannot read property
question
ofundefined
P.S i'm begginer