Last active
April 30, 2017 23:18
-
-
Save geetotes/21ba43b696645059566ad1c70d4d1b4f to your computer and use it in GitHub Desktop.
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
class BasicWizard extends React.Component { | |
/* | |
snip... | |
*/ | |
_next(data) { | |
// data is the user input from the form | |
// it could be saved here in state or POSTed to an API, for example | |
// after that is done, we'll move currentStep forward | |
// look familiar? | |
let currentStep = this.state.currentStep; | |
if (currentStep >= 2) { | |
currentStep = 3; | |
} else { | |
currentStep = currentStep + 1; | |
} | |
this.setState({ | |
currentStep: currentStep | |
}); | |
} | |
render() { | |
let currentStep - this.state.currentStep; | |
return( | |
<div> | |
<Step1 currentStep={currentStep) afterValid={this._next} /> | |
<Step2 currentStep={currentStep) afterValid={this._next} /> | |
<Step3 currentStep={currentStep) afterValid={this._next} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment