Skip to content

Instantly share code, notes, and snippets.

@rahsheen
Last active May 29, 2017 19:57
Show Gist options
  • Save rahsheen/24db991e2394ff2c68cb4e5f75f1eae0 to your computer and use it in GitHub Desktop.
Save rahsheen/24db991e2394ff2c68cb4e5f75f1eae0 to your computer and use it in GitHub Desktop.
React Wizard Interface
// via @wordyallen
class ModalContent extends React.Component{
state={currentView:0}
style=create({
card:{
justifyContent:'space-around',
alignItems:'center',
minWidth:300,
}
})
nextView () => this.setState({currentView: this.state.currentView + 1})
render (){
const [{text}, {currentView}, {card}] = [this.props, this.state, this.style]; // Thanks @vishalgautamm
return <Card>
{
currentView===0 ? <Form nextView={this.nextView}/>
:currentView===1 ? <Confirmation nextView={this.nextView} />
:currentView===2 ? <Result />
:null
}
</Card>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment