Anonymous users
How to use Reflag with anonymous users
How to toggle features for anonymnous users
import { ReflagClient } from "@reflag/node-sdk";
const client = new ReflagClient(...)
// using an empty context for anonymous users
const { isEnabled } = client.bindClient({}).getFlag("export-to-csv")import { ReflagProvider } from "@reflag/react-sdk";
function App() {
return (
<ReflagProvider> // no user/company provided
<Routes />
</ReflagProvider>
);
}
How to toggle features for anonymous users where you know their company
import { ReflagClient } from "@reflag/node-sdk";
const client = new ReflagClient(...)
// supply only the company ID if the users is anonymous but belongs to a company
const { isEnabled } = client.bindClient({company: {id: "petes-burgers"}).getFlag("export-to-csv")import { ReflagProvider } from "@reflag/react-sdk";
function App() {
return (
<ReflagProvider company={{id: "petes-burgers"}}> // company provided
<Routes />
</ReflagProvider>
);
}
Last updated
Was this helpful?