Skip to content

Instantly share code, notes, and snippets.

@grantsheppard
Created April 6, 2017 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantsheppard/3aed6392d0c6fb59c9265c98852eca43 to your computer and use it in GitHub Desktop.
Save grantsheppard/3aed6392d0c6fb59c9265c98852eca43 to your computer and use it in GitHub Desktop.
// a simple feature toggle FaCC
const Toggle = () => {
const isToggledOn = checkToggle(this.props.toggleName)
return this.props.children(isToggledOn)
}
// and to use it
<Toggle toggleName="featureAorB">
{ isToggledOn => isToggledOn ? <FeatureA /> : <FeatureB /> }
</Toggle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment