title: "Maximum update depth exceeded ..." when parent callback is called in React-Native
body: <p>I still don't get why I'm getting an update depth exceeded on this specific case, i would appreciate if any help is given.</p>
  
  <p>To give some insight.</p>
  
  <p>I got a Parent and a Child (multi-list selector) component that I created.
  This multi-list allows you to select multiple items and when modal is closed, I execute a callback that comes from Parent, with the list of items selected and update it from the Parent itself by doing setState.</p>
  
  <p>On Parent's constructor I got the callback function like this:</p>
  
  <p><strong>Parent</strong></p>
  
  <p><code>this.onItemSelected = this.onItemSelected.bind(this);</code></p>
  
  <p>This is the function above:</p>
  
  <pre><code>onItemSelected(updatedList) {
      this.setState({selectedItemList: updatedList});
  }
  </code></pre>
  
  <p>This is when I use it and pass it to Children.</p>
  
  <pre><code>renderModalMultiSelect = () =&gt; {
          return (
              &lt;MultiSelect
                  items={this.state.itemList}
                  onItemSelect={ this.onItemSelected }
                  disabled={this.state.filters.type === 'all'}
                  isLoadingList={this.state.isLoadingList}
              /&gt;
          )
      }
  </code></pre>
  
  <p>Of course this is on Parent's render() function as <code>{ this.renderModalMultiSelect() }</code></p>
  
  <p><strong>Children</strong></p>
  
  <p>On this component, I handle the selected item list locally, is not on the State, so whenever I press on items, I just simply do a push on this local array.
  When I close the modal, I run the parent props callback.</p>
  
  <pre><code>onClose = () =&gt; {
          this.setState({ modalOpened: false }, () =&gt; {
              // Optional callback
              if (this.props.onItemSelect) {
                  this.props.onItemSelect(this.selectedItems);
              }
          })
      }
  </code></pre>
  
  <p>Again, this function is used on children's render()</p>
  
  <pre><code>&lt;Button onPress={ this.onClose } transparent&gt;
      &lt;Icon name="md-arrow-back" style={ styles.headerIcon }/&gt;
  &lt;/Button&gt;
  </code></pre>
  
  <p>Before this, I was passing a state from Parent to Children with the list of selected items, but it didn't seem right to do things like: <code>this.props.selectedItemList.push(item)</code> or is this fine to do?</p>
  
  <p>Thanks and I hope I can understand what's going on here, it keeps throwing this error whenever I close the modal (onClose is called).</p>