Skip to content

getsidekicker/flagr-feature-react

Repository files navigation

flagr-feature-react

image

Usage

import { useFlagr, FlagrContextProvider } from 'flagr-feature-react';

const ID = 'user_123';
const SOME_URL = 'flagrUrl';
const APP_TAGS = ['local'];
const OPTIONAL_CONTEXT = undefined;

const MyApp = () => (
  <FlagrContextProvider
    flagrUrl={SOME_URL}
    tags={APP_TAGS}
    context={OPTIONAL_CONTEXT}
    id={ID}
  >
    <MyComponent />
  </FlagrContextProvider>
);

const MyComponent = () => {
  const { match, loaded } = useFlagr();

  return (
    <>
      {!loaded && 'loading'}
      {loaded && match?.('someFeature') ? 'new hotness' : 'old and busted'}
    </>
  );
};

Installation

Requires npm 7

npm install

Development

npm run dev

Deployment

npm run build

Publishing

This is handled by GitHub actions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •