npm.io
0.1.2 • Published 4d ago

@softlaunch/react

Licence
MIT
Version
0.1.2
Deps
2
Size
42 kB
Vulns
0
Weekly
0
Stars
1

@softlaunch/react

Softlaunch feature flag SDK for React. A provider and hooks that evaluate flags locally and re-render automatically when your configuration changes.

Install

npm install @softlaunch/react

Usage

import { SoftlaunchProvider, useBooleanFlag } from "@softlaunch/react";

function App() {
  return (
    <SoftlaunchProvider sdkKey="slc_...">
      <Checkout />
    </SoftlaunchProvider>
  );
}

function Checkout() {
  const { value: showRedesign } = useBooleanFlag("checkout-redesign", "user-123", { plan: "pro" }, false);
  return showRedesign ? <NewCheckout /> : <OldCheckout />;
}

Documentation

See docs.softlaunch.so.

License

MIT