When using the LaunchDarkly component in a universal app, the rendering of LaunchDarkly may occur server-side. This poses a problem since ldclient-js is only for the browser. It uses XMLHttpRequest which is not available in node. For reference, this wasn't an issue prior to 0.0.9. However, in 0.0.9, we moved the client initialization into the LaunchDarkly component.
Solution
Moving the initialization of the client into the FeatureFlag component, we can ensure that the LaunchDarkly component can continue to be used at the top-most level in your component hierarchy.
Problem
When using the
LaunchDarkly
component in a universal app, the rendering ofLaunchDarkly
may occur server-side. This poses a problem sinceldclient-js
is only for the browser. It usesXMLHttpRequest
which is not available in node. For reference, this wasn't an issue prior to 0.0.9. However, in 0.0.9, we moved the client initialization into theLaunchDarkly
component.Solution
Moving the initialization of the client into the
FeatureFlag
component, we can ensure that theLaunchDarkly
component can continue to be used at the top-most level in your component hierarchy.