Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

React-Native array of refs

$
0
0

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?


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>