{"repo":"sergiodxa/flagged","free":true,"listed":false,"github":"https://github.com/sergiodxa/flagged","clone":"git clone https://github.com/sergiodxa/flagged.git","description":"Feature Flags for React made easy with hooks, HOC and Render Props","language":"TypeScript","stars":434,"topics":["react","hooks","react-hooks","higher-order-component","hoc","render-props","render-prop","typescript","feature-flags"],"license":"MIT","category":"ui-components","readme_excerpt":"Flagged ### Feature flags for React made easy with hooks, HOC and Render Props Features - Hooks API - High Order Component API - Render Props API - TypeScript Support - Zero Dependencies - Nested Flags How to Use It Install it from npm. Import the FlagsProvider in your code and wrap your application around it. Now use useFeature , withFeature or Feature to check if the feature is enabled in your application: Features Valid Values The features prop you pass to FlagsProvider could be an array of strings or an object, if you decide to use an object you could also pass nested objects to group feature flags together. Using an Array Using an Object Using Nested Objects If you use nested objects you will need to either use the useFeatures hook or pass a string separated by / , e.g. content/moderate to read nested flags, if you don't pass the whole path you will get an object so content will return { moderate: false } when reading it. useFeature Custom Hook The useFeature custom hook is the base for the HOC and Render Prop implementation, it lets you check if a single feature is enabled and get a boolean, then you can do anything you want with that value, uesful to use it in combination with other hooks like useEffect or to show two different UIs based on a feature being enabled or not. withFeature High Order Component This withFeature high order component let's you wrap a component behind a feature flag, this way the parent component using your wrapped component doesn't need to know","default_branch":null,"files":null,"tree":[],"storefront":"/r/sergiodxa","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sergiodxa/flagged/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}