I am trying to have a component change and access the variables of another component (sibling components, without a child/parent relationship). I want to do this via querySelecting the components by a particular class name, and then getting the component reference from its HTML tag.
For instance, say there are 3 Response components, 2 of which have the class "group-1" and 1 which has "group-2", and a Trigger component. These are all sibling components.
From the Trigger component, I want to be able to access the 2 Response components that have the class "group-1".
Currently, I have:
Within Trigger Component:
const group1ResponseComponents = document.querySelectorAll(".group-1");
forEach((response: Element) => {
let responseComponent = response. ???? (get the Component Ref from its HTML)
responseComponent.varA = true;
});
I can get the ... component HTML, but how do I actually get the component? Vue has something like '.__vue__' to from the native element to the component. I can't really use ViewChildren or ContentChildren in this scenario since they are sibling components. Any ideas?