-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathSurveyNew.js
More file actions
37 lines (32 loc) · 773 Bytes
/
SurveyNew.js
File metadata and controls
37 lines (32 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SurveyNew shows SurveyForm and SurveyFormReview
import React, { Component } from 'react';
import { reduxForm } from 'redux-form';
import SurveyForm from './SurveyForm';
import SurveyFormReview from './SurveyFormReview';
class SurveyNew extends Component {
state = { showFormReview: false };
renderContent() {
if (this.state.showFormReview) {
return (
<SurveyFormReview
onCancel={() => this.setState({ showFormReview: false })}
/>
);
}
return (
<SurveyForm
onSurveySubmit={() => this.setState({ showFormReview: true })}
/>
);
}
render() {
return (
<div>
{this.renderContent()}
</div>
);
}
}
export default reduxForm({
form: 'surveyForm'
})(SurveyNew);