Skip to content

Instantly share code, notes, and snippets.

Last active July 14, 2021 00:55
What would you like to do?
useFeatureFlag Example
import React from 'react';
import useFeatureFlag from './useFeatureFlag';
import RecommendationsComponent from './Recommendations.js';
const {
DecoratedComponent: Recommendations,
featureEnabled: recommendationsFeatureEnabled,
} = useFeatureFlag({
Component: RecommendationsComponent,
const ExampleComponent = () => {
const pageTitle = recommendationsFeatureEnabled ? 'Recommendations' : 'Saved Items';
return <div>
<Recommendations />
<Dependency recommendations={recommendations} />
import React from 'react';
const Recommendations = ({ featureEnabled }) => {
if (!featureEnabled) {
return <div>Page Not Found</div>
return <div>
export default Recommendations;
Copy link

This is a marvelous piece. Thank you very much for teaching this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment