Created
November 14, 2018 00:04
-
-
Save jordangarcia/dde7060c4a18307e74fcceca6c6445f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myFeature = createFeatureInstance('my-feature', { | |
getComponent(isEnabled, variables) { | |
return isEnabled | |
? ExtendedComponent | |
: StandardComponent | |
}, | |
fetchData(isEnabled, variables) { | |
return isEnabled | |
? getExtendedData() | |
: getStandardData() | |
}, | |
}) | |
// in routing | |
myFeature.fetchData() | |
// in component | |
render() { | |
const MyFeatureComponent = myFeature.getComponent() | |
return ( | |
<MyFeatureComponent {...propsToPass} /> | |
) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment