Affected: React Native SDK client-side <10.x
Symptoms
React Native SDK <10.x had some limitations on reloading React's native modules. In some cases performing a hot reload throws an error indicating that the LaunchDarkly SDK is already initialized.
LaunchDarkly SDK already initialized
Cause
The hot reloading is not fully supported by the React Native SDK <10.x. Specifically, the hot reloading behavior of the React Native SDK does not automatically reload React's native modules.
Solution
It is safe to catch this error and proceed; however, you must decide whether that is an appropriate behavior in your application.
Here's how:
let ldClient = new LDClient();
try {
await ldClient.configure(config, context);
} catch (err) {
console.log(err);
}
The React Native SDK version 10 and above does not have these limitations, so upgrading to this latest version is recommended.