Quick-start

Installation

Refer to the installation pagearrow-up-rightfor installation steps.

Flagship Usage

Initialization

Step 1: initialize the SDK with FlagshipProviderarrow-up-right . This is usually done in your App.js file to ensure your entire application is wrapped with the provider. Ensure also to include the required props such as envIdarrow-up-right , apiKeyarrow-up-right , and visitorDataarrow-up-right .

import React from "react";
import { FlagshipProvider } from "@flagship.io/react-native-sdk";

const App = () => (
  <>
    <FlagshipProvider
      envId="YOUR_ENV_ID"
      apiKey="YOUR_API_KEY"
      visitorData={{
        id: "YOUR_VISITOR_ID",
        hasConsented: true, // This is required
        context: {
          key:"value"
        },
      }}
    >
      {/* ... */}
    </FlagshipProvider>
  </>
);

👍 Good to know

\

Getting Flags

Steps 2 and 3 involve retrieving your flag, and reading your flag's value.

The React SDK provides two ways to retrieve a flagarrow-up-rightobject. This object includes methods to retrieve the flag value, access flag metadata, expose the flag, verify the flag's existence, and get the flag status.

You have two options:

👍 Good to know

\

Tracking hits

Step 4: Send hits to Flagship using the sendHitsarrow-up-rightmethod from the useFlagshiparrow-up-righthook. These hits help validate your objectives (KPIs) set up in your campaign.

Last updated

Was this helpful?