0.2.2 • Published 6 years ago

@spacemakerai/launchdarkly-react v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Spacemaker Launchdarkly React Typescript

An alternative to (@spacemakerai/ldclient-react)https://github.com/spacemakerai/spacemaker-launchdarkly, written in TypeScript (with TypeScript definition files) using React Hooks.

Changelog: CHANGELOG.md

Usage

Install:

$ yarn add @spacemakerai/launchdarkly-react

Usage:

import React from "react";
import { useVariation, createClient } from "@spacemakerai/launchdarkly-react";

const Component = () => {
  const user = {
    key: "foo@bar.com",
    email: "foo@bar.com"
  };
  const client = createClient(clientId, user);
  const feature = useVariation(client, "feature", false);

  return (
    <>
      <h1>My Component</h1>
      {feature && <p>My feature flagged feature</p>}
    </>
  );
};

Deployng

Update CHANGELOG.md and build:

$ yarn bulid

Add to stage:

$ git add .

Create a new version and publish to NPM registry:

$ yarn publish

Push your changes:

$ git push origin master
$ git push --tags

Hacking

To run a playground environment, run the following command:

$ CLIENT_ID=<your-client-id> yarn start

Server is then available at http://localhost:8080/.

To build, run the following command:

$ yarn build

To verify formatting:

$ yarn prettier:check

To fix formatting:

$ yarn prettier:write

To run the tests:

$ yarn test
0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago