import { FlagwardProvider, useFlag } from "@flagward/react";
function App() {
return (
<FlagwardProvider apiKey={process.env.NEXT_PUBLIC_FLAGWARD_KEY} host="https://app.flagward.com">
<Checkout />
</FlagwardProvider>
);
}
function Checkout() {
const { value, isLoading } = useFlag("new-checkout");
// `value` is undefined until the first snapshot arrives, and stays
// undefined for a key this environment does not have.
if (isLoading) return <LegacyCheckout />;
return value ? <NewCheckout /> : <LegacyCheckout />;
}