How to use the feature-toggle-jsx.withFeature function in feature-toggle-jsx

To help you get started, we’ve selected a few feature-toggle-jsx 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 matmalkowski / react-handyman / packages / sandbox / src / featureToggleExamples / withFeature / ComponentWithConfiguration.tsx View on Github external
const MyFeatureComponentWithConfig: React.FC = ({ myFeatureWithConfig: { items }, text, number }) => (
  <>
    <p>
      <strong>My Component</strong>
      <br>
      <span>
        You should see this {text} and {number}
      </span>
      <br>
      <span>{`with this configuration "${items.join(', ')}"`}</span>
    </p>
  
)

const WrappedComponentWithConfig = withFeature(MyFeatureComponentWithConfig, 'myFeatureWithConfig')

export { WrappedComponentWithConfig }

export default MyFeatureComponentWithConfig
github matmalkowski / react-handyman / packages / sandbox / src / featureToggleExamples / withFeature / Component.tsx View on Github external
interface Props {
  text: string
}

const MyFeatureComponent: React.FC = ({ text }) =&gt; (
  &lt;&gt;
    <p>
      <strong>My Component</strong>
      <br>
      <span>You should see this {text}</span>
    </p>
  
)

const WrappedComponent = withFeature(MyFeatureComponent, 'myFeature')

export { WrappedComponent }

export default MyFeatureComponent
github matmalkowski / react-handyman / packages / sandbox / src / featureToggleExamples / withFeature / DisabledComponent.tsx View on Github external
import * as React from 'react'
import { withFeature } from 'feature-toggle-jsx'
import { Features } from '../types'

const MyOtherFeatureComponent: React.FC&lt;{}&gt; = () =&gt; (
  &lt;&gt;
    <p>
      <strong>My Hidden Component</strong>
      <br>
      <span>You should not see this</span>
    </p>
  
)

const WrappedComponent = withFeature(MyOtherFeatureComponent, 'myOtherFeature')

export { WrappedComponent }

export default MyOtherFeatureComponent

feature-toggle-jsx

Toggle component on/off based on feature configuration

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis