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
// a simple feature toggle FaCC | |
const Toggle = () => { | |
const isToggledOn = checkToggle(this.props.toggleName) | |
return this.props.render(isToggledOn) | |
} | |
// and to use it | |
<Toggle | |
toggleName="featureAorB" | |
render={isToggledOn => isToggledOn ? <FeatureA /> : <FeatureB />} |
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
// 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> |
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 Component = ... | |
const mapStateToProps = ... | |
export default connect(mapStateToProps)(Component) |
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 withMousePosition = Component => class extends React.Component { | |
state = { | |
mouse: { x: 0, y: 0 } | |
} | |
onMouseMove = e => { | |
this.setState({ mouse: { x: e.clientX, y: e.clientY }}) | |
} | |
componentDidMount() { |
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
<Form onSubmit={this.handleSubmit}> | |
<p> | |
<TextInput name="firstName" placeholder="First Name"/> {' '} | |
<TextInput name="lastName" placeholder="Last Name"/> | |
</p> | |
<p> | |
<SubmitButton>Submit</SubmitButton> | |
</p> | |
</Form> |
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
class App extends React.Component { | |
render() { | |
return ( | |
<div> | |
<Tabs> | |
<TabPanels> | |
<TabPanel> | |
<p>Tacos are delicious</p> | |
</TabPanel> | |
<TabPanel> |
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
class App extends React.Component { | |
render() { | |
const tabData = [ | |
{ label: 'Tacos', description: <p>Tacos are delicious</p> }, | |
{ label: 'Burritos', description: <p>But burritos are better</p> } | |
] | |
return <Tabs data={tabData} tabsPlacement="bottom" disabled={[ 1 ]} /> | |
} | |
} |
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
class App extends React.Component { | |
render() { | |
const tabData = [ | |
{ label: 'Tacos', description: <p>Tacos are delicious</p> }, | |
{ label: 'Burritos', description: <p>But burritos are better</p> } | |
] | |
return <Tabs data={tabData} tabsPlacement="bottom" /> | |
} | |
} |
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
class App extends React.Component { | |
render() { | |
const tabData = [ | |
{ label: 'Tacos', description: <p>Tacos are delicious</p> }, | |
{ label: 'Burritos', description: <p>But burritos are better</p> } | |
] | |
return <Tabs data={tabData}/> | |
} | |
} |
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
<button onClick={this.openModal}>open modal</button> | |
<Modal isOpen={this.state.isModalOpen} onClose={this.closeModal}> | |
<button onClick={this.closeModal}>Close</button> | |
</Modal> |
NewerOlder