How to use the @flopflip/react.withProps function in @flopflip/react

To help you get started, we’ve selected a few @flopflip/react 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 tdeekens / flopflip / packages / react-broadcast / modules / components / toggle-feature / toggle-feature.ts View on Github external
import flowRight from 'lodash/flowRight';
import {
  ToggleFeature,
  getIsFeatureEnabled,
  setDisplayName,
  withProps,
  ALL_FLAGS_PROP_KEY,
} from '@flopflip/react';
import { withFlags } from '../configure';

export default flowRight(
  setDisplayName(ToggleFeature.displayName),
  withFlags(),
  withProps(props => ({
    isFeatureEnabled: getIsFeatureEnabled(
      props.flag,
      props.variation
    )(props[ALL_FLAGS_PROP_KEY]),
  }))
)(ToggleFeature);