How to use feature-toggle-jsx - 5 common examples

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
github matmalkowski / react-handyman / packages / sandbox / src / featureToggleExamples / FeatureToggleExamples.tsx View on Github external
const FeatureToggleExamples: React.FC = () =&gt; {
  return (
    &lt;&gt;
      <h2>withFeature</h2>
      
      
      

      <h2>withoutFeature</h2>
      
    
  )
}

export default withFeaturesProvider(FeatureToggleExamples, features)
github matmalkowski / react-handyman / packages / sandbox / src / featureToggleExamples / withoutFeature / DisabledComponent.tsx View on Github external
import * as React from 'react'
import { withoutFeature } from 'feature-toggle-jsx'
import { Features } from '../types'

const MyOtherFeatureComponent: React.FC&lt;{}&gt; = () =&gt; (
  &lt;&gt;
    <p>
      <strong>My Special Component</strong>
      <br>
      <span>You should see this when it's disabled !?</span>
    </p>
  
)

const WrappedComponent = withoutFeature(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