I have a function for set my states but it doesn't work correctly.
this is my function,
checkAnswer() {
this.setState({
isDropdownShown: false
});
}
and i'm calling like this,
renderAnswers(answer, idx) {
return (
<li
key={idx}
className={styles.questionDropdownItem}
onClick={() => this.checkAnswer(answer)}
>
{answer.title}
</li>
);
}
From His Comment:
I'm calling renderAnswers
method in render like this:
{question.answers.map(this.renderAnswers)}
I'm try everything like shouldComponentUpdate but it doesn't work.