Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
interface Props {
text: string
}
const MyFeatureComponent: React.FC = ({ text }) => (
<>
<p>
<strong>My Component</strong>
<br>
<span>You should see this {text}</span>
</p>
)
const WrappedComponent = withFeature(MyFeatureComponent, 'myFeature')
export { WrappedComponent }
export default MyFeatureComponent
import * as React from 'react'
import { withFeature } from 'feature-toggle-jsx'
import { Features } from '../types'
const MyOtherFeatureComponent: React.FC<{}> = () => (
<>
<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