I used callback refs by creating an empty array in the parent elementRefs = []; and then while iterating over the child components, I passed a function to the ref attribute ref={el => this.elementRefs[index] = el}. This way, it executes the function in the child, but it has elementRefs in its scope and add itself to the array. So at the end, you end up with an array elementRefs with all the ref elements in it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I used callback refs by creating an empty array in the parent
elementRefs = [];
and then while iterating over the child components, I passed a function to the ref attributeref={el => this.elementRefs[index] = el}
. This way, it executes the function in the child, but it has elementRefs in its scope and add itself to the array. So at the end, you end up with an arrayelementRefs
with all the ref elements in it.