1.1.1 • Published 5 years ago

@stretch0/react-feature-flag v1.1.1

Weekly downloads
9
License
-
Repository
gitlab
Last release
5 years ago

React Feature Flag

A comprehensive feature flag package for React

How to use

Feature flags can be toggled in order to hide or show new features in your react app. These can be toggled in 1 of 4 ways: (In order of highest priority)

  • React hook
  • URL query string parameter
  • Browser cookie
  • environment variable

Higher order component

import FeatureFlag from "react-feature-flag";

const MyComponent = () => {
  return (
    <FeatureFlag flag="REACT_APP_ENABLE_FEATURE">
      <div>My Feature</div>
    </FeatureFlag>
  )
}

React hook

import { useEffect } from "react";
import { useFeatureFlag } from "react-feature-flag";

const [showFeature, setShowFeature] = useFeatureFlag("REACT_APP_ENABLE_FEATURE")

useEffect(() => {
  setShowFeature(true)
}, [])  

return showFeature && <div>Hello</div>;
1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago