Trying to use the React and JavaScript SDKs for Optimizely, but getting the following error in the console:
OPTIMIZELY: Optimizely object is not valid. Failing isFeatureEnabled.
Run Code Online (Sandbox Code Playgroud)
More info about my setup below:
Installed via Yarn: yarn add @optimizely/react-sdk
Import statement in the app container:
import {
createInstance
} from '@optimizely/react-sdk'
Run Code Online (Sandbox Code Playgroud)
Logic in render function:
const optimizely = createInstance({
sdkKey: '<SDK_KEY>',
})
const enabled = optimizely.isFeatureEnabled('example_feature', 'user123');
Run Code Online (Sandbox Code Playgroud)
I get this error in the Chrome console:
OPTIMIZELY: Optimizely object is not …Run Code Online (Sandbox Code Playgroud) optimizely ×1