I create my components in a loop, and I need a way to retrieve data from them, but all my refs are undefinded.
<Tile id={i} key={i} isActive={this.state.isActive} num={numbers[i]} getNext={() => { return this.state.tilesTapped + 1 }} addToList={(id) => this.addToList(id)} ref={(input) => { this.tiles[i] = input }} />
And this is how I call them:
for (var i = 0; i < this.state.maxTiles; i++) { if (!this.tiles[i].check()) { res = false; } }
Is the syntax incorrect, or the problem is somewhere else?