title: react-native Redux updating state when returning
body: <p><strong>MY OBJECT</strong></p>
  
  <pre><code>const initialState = {
  1: {
      id: 1,
     price: 280
  },
  2: {
      id: 2,
      price: 200
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>ACTION</strong></p>
  
  <p>I want to take away $100 for the item user has clicked on. The console log works fine when I click on first Item it gives me 180. But how can I do that In my return function. I tried many times but nothing updated.</p>
  
  <pre><code>switch (action.type) {
    case 'BUY_ITEM':
      const getId = state[action.index]['price']
      console.log(getId - 100)
      //this console.log works fine
          return {
  
          }
     }
     return state
  }
  
  
   &lt;FlatList
   style={{ flex: 1 }}
   data={Object.values(this.props.data)}
   keyExtractor={(item, index) =&gt; index.toString()
   }
     renderItem={({ item }) =&gt; {
       return (
          &lt;Card style={styles.itemcontainer}&gt;
               &lt;Text style={[styles.text, { fontSize: 20,}]}&gt;${item.price}&lt;/Text&gt;
             &lt;Button style={styles.buyItem} bordered onPress={() =&gt; this.props.boughtItem(item.id)}&gt;
          &lt;Text style={{ fontSize: 17, paddingHorizontal: 25, color: '#333945', textAlign: 'center' }}&gt;
           &lt;FontAwesome name="cart-plus" style={styles.buyIcon} /&gt;
                                  {'  '}Add to cart
                                  &lt;/Text&gt;
                          &lt;/Button&gt;
                      &lt;/Card &gt;
                  )
              }}&gt;
          &lt;/FlatList&gt;
  </code></pre>