UNPKG

launchdarkly-react-client-sdk

Version:
16 lines (15 loc) • 767 B
import { LDFlagSet } from 'launchdarkly-js-client-sdk'; import React from 'react'; import { ReactSdkContext } from './types'; /** * `useFlags` is a custom hook which returns all feature flags. It uses the `useContext` primitive * to access the LaunchDarkly context set up by `withLDProvider`. As such you will still need to * use the `withLDProvider` HOC at the root of your app to initialize the React SDK and populate the * context with `ldClient` and your flags. * * @param reactContext If specified, the provided React context will be used. * * @return All the feature flags configured in your LaunchDarkly project */ declare const useFlags: <T extends LDFlagSet = LDFlagSet>(reactContext?: React.Context<ReactSdkContext>) => T; export default useFlags;