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 Nov 10 at 8:58
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
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown