I have the following nested components structure:
<question>
--> <answer>
--> <best-answer-button>
--> <answer>
--> <best-answer-button>
--> <answer>
--> <best-answer-button>
There can be multiple questions on the page. Each question can have multiple answers.
Now, when an answer is marked as best, I need to:
- let the parent
<question>
know, to add a "best answer" label or take it off - let all the sibling
<answer>
-s know
The point is, that I have to manipulate the question related to the <best-answer-button>
and all of the question's <answer>
-s, but I should not "touch" any other questions and answers on the page.
Is there a smooth way to fire an event from the <best-answer-button>
component only to its respective <question>
?