Closed
Description
Hi, is it correct behaviour that when we use
withOptimizely HOC we always should check props.optimizely for ready state before use ?
I mean
const Menu = props => {
useEffect(() => {
// we use
props.optimizely.onReady().then(() => {
console.log(props.optimizely.isFeatureEnabled('feature'));
});
// instead of using
console.log(props.optimizely.isFeatureEnabled('feature'));
}, []);
return </>;
};
export default withOptimizely(Menu);
I'm asking because in documentation there is an example without onReady check.
And If we do like in example we've got next error:
OPTIMIZELY: Optimizely object is not valid. Failing isFeatureEnabled.
Also my concern is that when we using OptimizelyFeature component we don't need to do additional checking but for withOptimizely we should. .
Metadata
Metadata
Assignees
Labels
No labels