Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     shouldComponentUpdate = (nextProps, nextState) => {
  2.         const { shops } = nextState;
  3.  
  4.         // current and next shops lengths
  5.         const currentLength = this.state.shops.length;
  6.         const nextLength = nextState.shops.length;
  7.         return (currentLength === nextLength && !this._shopsHasSelectedShop(shops)) || currentLength !== nextLength;
  8.     };
  9.  
  10.     _shopsHasSelectedShop = (shops) => {
  11.         return shops.some(shop => shop.id === this.state.selectedShopID);
  12.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement