This library is a wrapper for whatever feature flag service Island.is is using
Feature flagging is a way to soft launch a "beta ready" feature to a specific group of users.
Feature flagging is not a way to hide a feature from the users that is still a work in progress.
import { FeatureFlagContextProvider } from '@island.is/feature-flags'
then wrap your application using <FeatureFlagContextProvider>
.
import { FeatureFlagContext } from '@island.is/feature-flags'
render() {
const { featureFlagClient } = useContext(FeatureFlagContext)
const [showAwesome, setShowAwesome] = useState(true)
useEffect(() => {
const getData = async () => {
const featureEnabled = await featureFlagClient.getValue(
'isAwesomeFeatureEnabled',
false,
{
id: 'sindri',
},
)
setShowAwesome(featureEnabled as boolean)
}
getData()
}, [])
return `You are ${showAwesome ? 'awesome' : 'not really that awesome'}.`
}