Currently I am following the guidelines provided by launchdarkly and as per documentation I used:
import { asyncWithLDProvider } from 'launchdarkly-react-client-sdk';
(async () => {
const LDProvider = await asyncWithLDProvider({
clientSideID: 'CLIENT_SIDE_ID',
context: {
"kind": "user",
"key": "KEY",
"name": "NAME",
"email": "[email protected]"
},
});
render(
<LDProvider>
<ControllerPage />
</LDProvider>,
document.getElementById('reactDiv'),
);
})();
This somehow create problem as it's not working properly .
Also this is not my requirement even if it work I don't want to wrap my read code with <LDProvider></LDProvider>.
So i am asking is there any solution for this problem that I can use launchdarkly implementation using function without Wrapping my code with <LDProvider></LDProvider> .
This can be easily done as :
NPM Package :
Code :
Above code is used to evaluates all the flags. If you want to evaluate a particular flag then it would be like this :
Above , false represents if somehow error occurred then what would be the default value one should use.