React change state in array (for loop)
<p>I have a State with flights, and I have a slider to change the max price to change visibility of the flight elements.  </p>

<pre><code>maxpriceFilter() {

    var flightOffer = this.state.flightOffer;
    var sliderPrice = this.state.sliderPrice;

    for (var i = 0; i &lt; flightOffer.length; i++) {
        if( flightOffer[i].price &gt; sliderPrice) {   

            this.setState(
                {[flightOffer[i].hiddenprice] : true}
            );
        };
    }
</code></pre>

<p>This code is adding a undefined field with status true in the root of the state though.. I cant find any best practice on this, other then using computed fields. But I cant get the computed field working either..</p>

<p>Could someone please help me out here? </p>