React Native
Install
npm install @flipfeatureflag/react-native @flipfeatureflag/js
Provider
import { FlipFlagProvider } from "@flipfeatureflag/react-native";
export default function App() {
return (
<FlipFlagProvider
config={{
url: "https://api.example.com",
sdkKey: "YOUR_SDK_KEY",
context: { userId: "user-123" },
}}
>
<Root />
</FlipFlagProvider>
);
}
Hooks
import { useFlag, useVariant, useFlagsStatus, useUpdateContext } from "@flipfeatureflag/react-native";
function Screen() {
const { enabled, value } = useFlag("new_checkout");
const variant = useVariant("new_checkout");
const status = useFlagsStatus();
const updateContext = useUpdateContext();
return null;
}