@groundcontrolsh/react
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

GroundControl

GroundControl

React SDK for GroundControl.

Installing

With NPM

npm i @groundcontrolsh/groundcontrol @groundcontrolsh/react

With yarn

yarn add @groundcontrolsh/groundcontrol @groundcontrolsh/react

Usage

import { GroundControlClient } from "@groundcontrolsh/groundcontrol";
import { GroundControlProvider, useFeatureFlag } from "@groundcontrolsh/react";

// In your top-most component tree
const client = new GroundControlClient({
  projectId: "YOUR_PROJECT_ID",
  apiKey: "YOUR_API_KEY",
  cache: 60, // Optional. For how long results are cached in seconds. Defaults to not caching.
});

function App() {
  // The cache prop defines for how long results are cached in seconds. Defaults to not caching.
  return <GroundControlProvider client={client}>...</GroundControlProvider>;
}

// In your components
function MyComponent() {
  const isEnabled = useFeatureFlag("flag-name");
  const isEnabledForActor = useFeatureFlag("flag-name", {
    actors: ["actor1234"],
  });

  // ...
}

Readme

Keywords

none

Package Sidebar

Install

npm i @groundcontrolsh/react

Weekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

46.6 kB

Total Files

15

Last publish

Collaborators

  • gimenete