Created
July 19, 2023 05:59
-
-
Save leovido/9f6012980d20469a77d4fee7bdf03fd8 to your computer and use it in GitHub Desktop.
Feature flags - Example for preserving existing components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fancyFeatureFlagEnabled = featureFlagService("fancy_feature") | |
if (fancyFeatureFlagEnabled) { | |
<App /> | |
} else { | |
<NewApp /> | |
} | |
// App.tsx | |
export const App: FC = () => { | |
return ( | |
<Provider store={store}> | |
<OtherProvider> | |
<YetAnotherProvider> | |
<YetAnotherProvider /> | |
<OtherProvider /> | |
<Provider /> | |
) | |
} | |
export const NewApp: FC = () => { | |
return ( | |
<Provider store={store}> | |
<FancyProvider> | |
<OtherProvider> | |
<YetAnotherProvider> | |
<YetAnotherProvider /> | |
<OtherProvider /> | |
<FancyProvider /> | |
<Provider /> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment