Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shouldComponentUpdate = (nextProps, nextState) => {
- const { shops } = nextState;
- // current and next shops lengths
- const currentLength = this.state.shops.length;
- const nextLength = nextState.shops.length;
- return (currentLength === nextLength && !this._shopsHasSelectedShop(shops)) || currentLength !== nextLength;
- };
- _shopsHasSelectedShop = (shops) => {
- return shops.some(shop => shop.id === this.state.selectedShopID);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement