Last active
May 10, 2017 04:36
-
-
Save distributedlife/2458460db44e455d52c3328ce9f1874b to your computer and use it in GitHub Desktop.
Feature Toggling Playbook
This file contains hidden or 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 MyComponent = ({ toggle, ...props }) => ( | |
toggle ? <ComponentA {...props} /> : <ComponentB {...props} /> | |
); |
This file contains hidden or 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
import { toggle } from './compileTimeToggles'; | |
const MyComponent = () => (<p>Boom</p>); | |
export default () => (toggle ? <MyComponent /> : null); |
This file contains hidden or 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
import { connect } from 'react-redux'; | |
const MyComponent = () => (<p>Boom</p>); | |
const ToggledMyComponent = ({ toggle }) => (toggle ? <MyComponent /> : null); | |
export default connect((state) => ({ toggle: false })(ToggledMyComponent); |
This file contains hidden or 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 MyComponent = () => (<p>Boom</p>); | |
const Consumer = ({ toggle }) => ( | |
toggled && <MyComponent /> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment