0

I want to dynamically call variables in React native. For example;

//web
const item0 = [];
const item1 = [];
const item2 = [];

let i;
for (i = 0; i < 3; i++) {
  window['item'+i].push(1)
}

I can do this using 'window' for web. How do I use window in react native or is there a similar usage?

aliosmankepir
  • 139
  • 10

0 Answers0