title: Getting fetch result from the second time
body: <p>What am I doing wrong? price and article do not render on the first qr scan but from the second, third... I am guessing that it got something to do with asynchronous code, but I can not see what i need to do... Can someone help me please?   Tnx in advance!</p>
  
  <pre><code>export default class Qr extends Component {
    state = {    
      price: [],
      article: [],
    };
  
    qrCodeOnReadHandler = ({ data }) =&gt; {
      let price = this.state.price;
      let article = this.state.article;
  
    fetch(data)
      .then(response =&gt; response.json())
      .then(json =&gt; [
        console.log(json),
        article.push(json[0]),
        price.push(parseInt(json[4]))
      ]);
  
    console.log(price);
    console.log(article);
   };
  
  render() {
      return (
        &lt;View style={{ flex: 1 }}&gt;
           &lt;View style={styles.price}&gt;
                &lt;Text style={styles.text}&gt;Proizvod: {this.state.article}&lt;/Text&gt;
           &lt;/View&gt;
           &lt;View style={styles.price}&gt;
                &lt;Text style={styles.text}&gt;Cena: {this.state.price}&lt;/Text&gt;
           &lt;/View&gt;
        &lt;/View&gt;
      );
    }
  }
  </code></pre>