Initialize react form on material UI stepper with Redux state
up vote
0
down vote
favorite
I am working on a React applcation and using Redux for state management.
I have a stepper which has 3 forms in 3 steps. On last step, i have to call a post request to an API. What i am thinking is to have a redux state containing all the fields spreaded in 3 forms. Now i am able to update the redux state on Next button on each stepper form but when i come back, i see an empty form.
- Is my approach is correct?
- how do i see the fields when stepper changes or page refresh?
Below is the code that i have tried so far but dont know how to bind it with text field.
componentWillMount() {
// This method runs when the component is first added to the page
this.setState({
assetName: this.props.asset.assetName,
assetDesc: this.props.asset.assetDesc,
path: this.props.asset.path,
classification: this.props.asset.classification
});
console.log(this.state.assetName);
}
state = {
assetName :'',
assetDesc:'',
path:'',
classification:'',
};
Thanks
reactjs redux react-redux material-ui
add a comment |
up vote
0
down vote
favorite
I am working on a React applcation and using Redux for state management.
I have a stepper which has 3 forms in 3 steps. On last step, i have to call a post request to an API. What i am thinking is to have a redux state containing all the fields spreaded in 3 forms. Now i am able to update the redux state on Next button on each stepper form but when i come back, i see an empty form.
- Is my approach is correct?
- how do i see the fields when stepper changes or page refresh?
Below is the code that i have tried so far but dont know how to bind it with text field.
componentWillMount() {
// This method runs when the component is first added to the page
this.setState({
assetName: this.props.asset.assetName,
assetDesc: this.props.asset.assetDesc,
path: this.props.asset.path,
classification: this.props.asset.classification
});
console.log(this.state.assetName);
}
state = {
assetName :'',
assetDesc:'',
path:'',
classification:'',
};
Thanks
reactjs redux react-redux material-ui
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am working on a React applcation and using Redux for state management.
I have a stepper which has 3 forms in 3 steps. On last step, i have to call a post request to an API. What i am thinking is to have a redux state containing all the fields spreaded in 3 forms. Now i am able to update the redux state on Next button on each stepper form but when i come back, i see an empty form.
- Is my approach is correct?
- how do i see the fields when stepper changes or page refresh?
Below is the code that i have tried so far but dont know how to bind it with text field.
componentWillMount() {
// This method runs when the component is first added to the page
this.setState({
assetName: this.props.asset.assetName,
assetDesc: this.props.asset.assetDesc,
path: this.props.asset.path,
classification: this.props.asset.classification
});
console.log(this.state.assetName);
}
state = {
assetName :'',
assetDesc:'',
path:'',
classification:'',
};
Thanks
reactjs redux react-redux material-ui
I am working on a React applcation and using Redux for state management.
I have a stepper which has 3 forms in 3 steps. On last step, i have to call a post request to an API. What i am thinking is to have a redux state containing all the fields spreaded in 3 forms. Now i am able to update the redux state on Next button on each stepper form but when i come back, i see an empty form.
- Is my approach is correct?
- how do i see the fields when stepper changes or page refresh?
Below is the code that i have tried so far but dont know how to bind it with text field.
componentWillMount() {
// This method runs when the component is first added to the page
this.setState({
assetName: this.props.asset.assetName,
assetDesc: this.props.asset.assetDesc,
path: this.props.asset.path,
classification: this.props.asset.classification
});
console.log(this.state.assetName);
}
state = {
assetName :'',
assetDesc:'',
path:'',
classification:'',
};
Thanks
reactjs redux react-redux material-ui
reactjs redux react-redux material-ui
asked 20 hours ago
Abhinav Singh
154
154
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237438%2finitialize-react-form-on-material-ui-stepper-with-redux-state%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password