Objects in React Native
<p>I have a piece of text and every time you click on it the text changes to the next item in the object. I also need the name of the one saying the text so I used a multidimensional array like this:</p>

<pre><code>let texts = {
  0:{
    "name" : "Bob",
    "text" : "Hello, this is a text",
  },
  1:{
    "name" : "Peter",
    "text" : "Hey there.",
  },
};
</code></pre>

<p>This is my state:</p>

<pre><code>this.state = {
  textNumber: 0,
};
</code></pre>

<p>And this is the function I call onPress:</p>

<pre><code>nextScene = () =&gt; {
      if(this.state.textNumber &gt;= Object.keys(texts).length-1){

      }
      else{
        this.setState({textNumber: this.state.textNumber+1})
      }
    };
</code></pre>

<p>It works perfectly just the way I want it. But my question is: is this the way it should be done in React Native? Or is there a better way?</p>