title: Does it make sense to compare arrays of objects in React's shouldComponentUpdate?
body: <p>I am experimenting with React and I was trying to optimize Components update, etc.</p>
  
  <p>I'm building a search component that returns an array of objects. To optimize it I was trying to prevent my component from updating if the search results are the same after performing a new search.</p>
  
  <p>Right now I'm using Immutable to compare them and it works.</p>
  
  <p>Any comments about the performance side of this? Does it make sense to do it in general? Any more efficient ways to do it?</p>
  
  <p>This is my component.</p>
  
  <pre><code>class ItemsListContainer extends React.Component {
  
    componentDidMount() {
      itemsApi.getItems();
      store.dispatch(loadSearchLayout('items', 'found items'));
    }
  
    shouldComponentUpdate(nextProps, nextState) {
      let prevItems = Immutable.fromJS(this.props.items);
      let nextItems = Immutable.fromJS(nextProps.items);
      return !Immutable.is(prevItems, nextItems)
    }
  
    render() {
      return (
        &lt;ItemsList items={this.props.items} /&gt;
      );
    }
  
  };
  
  const mapStateToProps = function(store) {
    return {
      items: store.itemsState.items
    };
  };
  
  export default connect(mapStateToProps)(ItemsListContainer);
  </code></pre>