Feature flag hook
useFeatureFlag is a custom React hook that determines whether a feature flag is enabled based on the presence and value of specific cookies. It checks the cookies provided as keys and returns true if any of them are set to 'true'. Otherwise, it returns false.
This hook is useful for conditional rendering of features based on user-specific feature toggles managed via cookies. Usage :
parentCpt :: R.Component ()
parentCpt = here.component "container" cpt
where
cpt _ _ = do
shouldBeVisible <- useFeatureFlag ["keyOne", "keyTwo", "keyThree"]
pure $
H.div {} [if shouldBeVisible then H.text "I should be visible" else H.text "Im not visible"]
Use feature component to wrap your component behind a feature flag. It might be cleaner to use it instead of directly using the useFeatureFlag hook Usage:
feature { keys: [ "keyOne" ], render: \shouldRender -> if shouldRender then H.text "hello" else H.text "you cant see me" }