launchdarkly-react-client-sdk
Version:
LaunchDarkly SDK for React
23 lines • 1.1 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("react");
var context_1 = __importDefault(require("./context"));
// tslint:disable:max-line-length
/**
* `useLDClient` is a custom hook which returns the underlying [LaunchDarkly JavaScript SDK client object](https://launchdarkly.github.io/js-client-sdk/interfaces/_launchdarkly_js_client_sdk_.ldclient.html).
* Like the `useFlags` custom hook, `useLDClient` also uses the `useContext` primitive to access the LaunchDarkly
* context set up by `withLDProvider`. You will still need to use the `withLDProvider` HOC
* to initialise the react sdk to use this custom hook.
*
* @return The `launchdarkly-js-client-sdk` `LDClient` object
*/
// tslint:enable:max-line-length
var useLDClient = function () {
var ldClient = react_1.useContext(context_1.default).ldClient;
return ldClient;
};
exports.default = useLDClient;
//# sourceMappingURL=useLDClient.js.map