UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

18 lines (17 loc) 803 B
import React from 'react'; /** * This function is used to switch between two components based on a feature flag * @param ComponentOld * @param ComponentNext * @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('platform_editor_react18_phase2_v2') * @returns */ export var withFeatureFlaggedComponent = function withFeatureFlaggedComponent(ComponentOld, ComponentNext, featureFlagFn) { return function (props) { // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading return featureFlagFn() ? /*#__PURE__*/React.createElement(ComponentNext, props) : /*#__PURE__*/React.createElement(ComponentOld, props); }; };