How to use the @flopflip/react.getIsFeatureEnabled 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 / hooks / use-feature-toggles / use-feature-toggles.ts View on Github external
(previousFlags, [flagName, flagVariation]: [FlagName, FlagVariation]) => {
      const isFeatureEnabled: boolean = getIsFeatureEnabled(
        flagName,
        flagVariation
      )(allFlags);

      return [...previousFlags, isFeatureEnabled];
    },
    []
github tdeekens / flopflip / packages / react-broadcast / modules / components / toggle-feature / toggle-feature.ts View on Github external
withProps(props => ({
    isFeatureEnabled: getIsFeatureEnabled(
      props.flag,
      props.variation
    )(props[ALL_FLAGS_PROP_KEY]),
  }))
)(ToggleFeature);
github tdeekens / flopflip / packages / react-broadcast / modules / hooks / use-feature-toggle / use-feature-toggle.ts View on Github external
export default function useFeatureToggle(
  flagName: FlagName,
  flagVariation: FlagVariation = true
): boolean {
  const flags: Flags = React.useContext(FlagsContext);
  const isFeatureEnabled: boolean = getIsFeatureEnabled(
    flagName,
    flagVariation
  )(flags);

  React.useDebugValue({
    flagName,
    flagVariation,
    isEnabled: isFeatureEnabled,
  });

  return isFeatureEnabled;
}
github tdeekens / flopflip / packages / react-redux / modules / components / toggle-feature / toggle-feature.ts View on Github external
export const mapStateToProps = (state: State, ownProps: OwnProps): object => ({
  isFeatureEnabled: getIsFeatureEnabled(
    ownProps.flag,
    ownProps.variation
  )(state[STATE_SLICE].flags ?? {}),
});