UNPKG

@launchdarkly/react-native-client-sdk

Version:
23 lines 812 B
import { jsx as _jsx } from "react/jsx-runtime"; import { useEffect, useState } from 'react'; import { Provider } from './reactContext'; import setupListeners from './setupListeners'; /** * This is the LaunchDarkly Provider which uses the React context api to store * and pass data to child components through hooks. * * @param client The ReactNativeLDClient object. Initialize this object separately * and then set this prop when declaring the LDProvider. * @param children * * @constructor */ const LDProvider = ({ client, children }) => { const [state, setState] = useState({ client }); useEffect(() => { setupListeners(client, setState); }, []); return _jsx(Provider, { value: state, children: children }); }; export default LDProvider; //# sourceMappingURL=LDProvider.js.map