How to use the fbjs/lib/shallowEqual function in fbjs

To help you get started, we’ve selected a few fbjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unirakun / k-ramel / packages / connectors / react / src / inject.jsx View on Github external
shouldComponentUpdate(nextProps, nextState) {
      if (this.first) return true

      const { injectedProps } = this.state // eslint-disable-line react/prop-types

      return !(
        shallowEqual(this.props, nextProps)
        && shallowEqual(
          withoutFunctions(nextState.injectedProps),
          withoutFunctions(injectedProps),
        )
      )
    }
github onmyway133 / PushNotifications / node_modules / recompose / es / Recompose.js View on Github external
WithStateHandlers.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
        var propsChanged = nextProps !== this.props;
        // the idea is to skip render if stateUpdater handler return undefined
        // this allows to create no state update handlers with access to state and props
        var stateChanged = !shallowEqual(nextState, this.state);
        return propsChanged || stateChanged;
      };
github poooi / poi / views / components / tab-area / tab-contents-union.es View on Github external
shouldComponentUpdate(nextProps, nextState) {
    return (
      !shallowEqual(omit(this.props, ['children']), omit(nextProps, ['children'])) ||
      !shallowEqual(this.state, nextState) ||
      !isEqual(this.childrenKey(this.props.children), this.childrenKey(nextProps.children))
    )
  }
github planttheidea / react-billboardjs / src / index.js View on Github external
return (nextProps, nextState, nextContext) => {
    const {isPure} = nextProps;

    return isPure ? !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.context, nextContext) : true;
  };
};
github dylanmoz / glamorous-grid / src / Col.js View on Github external
shouldClassNameUpdate: (props, nextProps, context, nextContext) => (
      !shallowEqual(context.theme, nextContext.theme)
      || !shallowEqual(props.span, nextProps.span)
      || !shallowEqual(props.equalWidth, nextProps.equalWidth)
      || !shallowEqual(props.auto, nextProps.auto)
      || !shallowEqual(props.offset, nextProps.offset)
      || !shallowEqual(props.alignSelf, nextProps.alignSelf)
      || !shallowEqual(props.textAlign, nextProps.textAlign)
    )
  }
github LedgerHQ / ledgerjs / packages / common / src / restlay / connectData.js View on Github external
shouldComponentUpdate(props: ClazzProps, state: State) {
      if (freezeTransition) {
        if (state.pending) return false;
      } else {
        if (state.pending !== this.state.pending) {
          return true;
        }
      }
      return (
        !shallowEqual(
          extractInputProps(this.props),
          extractInputProps(props)
        ) || !shallowEqual(sCUStateSubset(this.state), sCUStateSubset(state))
      );
    }
github dylanmoz / glamorous-grid / src / Col.js View on Github external
shouldClassNameUpdate: (props, nextProps, context, nextContext) => (
      !shallowEqual(context.theme, nextContext.theme)
      || !shallowEqual(props.span, nextProps.span)
      || !shallowEqual(props.equalWidth, nextProps.equalWidth)
      || !shallowEqual(props.auto, nextProps.auto)
      || !shallowEqual(props.offset, nextProps.offset)
      || !shallowEqual(props.alignSelf, nextProps.alignSelf)
      || !shallowEqual(props.textAlign, nextProps.textAlign)
    )
  }
github regentmarkets-repo-archive / binary-charts-archived / src / config / updateChart.js View on Github external
const tradingTimesAreEqual = (prevProps, nextProps) =>
    shallowEqual(nextProps.tradingTimes, prevProps.tradingTimes);
github digibib / ls.ext / redef / patron-client / src / frontend / containers / Search.js View on Github external
componentDidUpdate (prevProps) {
    if (!shallowEqual(this.filterLocationQuery(this.props.locationQuery), this.filterLocationQuery(prevProps.locationQuery))) {
      this.props.searchActions.search()
    }
  }
github planttheidea / react-billboardjs / src / BillboardChart.js View on Github external
export const shouldComponentUpdate = ({context, props}, [nextProps, , nextContext]) =>
  nextProps.isPure ? !shallowEqual(props, nextProps) || !shallowEqual(context, nextContext) : true;