JavaScript and TypeScript
Use the SDK in Node, the browser, React and edge runtimes.
Node and edge
import { createClient } from '@plinth/sdk';
const plinth = createClient({ key: process.env.PLINTH_SERVER_KEY });
React
import { PlinthProvider, useFlag } from '@plinth/react';
function Checkout() {
const on = useFlag('checkout-v2');
return on ? <NewCheckout /> : <OldCheckout />;
}
Offline behaviour
The SDK keeps the last rules it received. If the connection drops, flags keep their last known value, then fall back to their defaults.
Stuck? Email support@plinth.example