Within my Vue.js code, I am facing an issue. I have questions retrieved from an API along with their respective categories stored in an array called 'questions'. My goal is to be able to filter the questions based on the category that is clicked. However, my current code only displays a single question and its category, instead of showing all related questions for the selected category. Can anyone provide assistance with this?
selectedAnswer(index) {
this.selectedIndex = index;
this.questions = this.questions.filter((question) =>
question.categories.includes(index)
);
console.log(index);
},