React
This document explains all the methods available in the client-side React SDK.
Getting started
If still not registered, sign up and create an account at https://koople.io.
1. Install and import package
npm i @pataflags/sdk-react2. Initialize the SDK
import { KProvider } from "@pataflags/sdk-react";
const App = () => {
const user = { id: 'aUserId' };
return (
<KProvider apiKey={'YOUR_API_KEY'} user={user}>
<MyComponent />
</KProvider>
);
};3. Get your values
Customize the SDK
All customization options are the same as the Javascript SDK.
Hooks
The next hooks are based on the JavaScript SDK methods.
useReleaseToggles
useReleaseToggles is a custom hook that returns all release toggles.
useIsEnabled
useIsEnabled is a custom hook that returns a one release toggle status.
useRemoteConfigs
useRemoteConfigs is a custom hook that returns all remote configs.
useValueOf
useValueOf is a custom hook that returns one remote config value.
useEvaluation
useEvaluation is a custom hook that returns an evaluation object.
useIdentify
useIdentify is a custom hook for identify user. Commonly is used when the user makes sign-in. It returns a function that receives a user.
useRefresh
useRefresh is a custom hook for force manual polling.
Components
ReleaseToggle
Last updated
Was this helpful?