New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to reset the form after async call #11
Comments
I did something like:
I'm not sure if the constants are exported anywhere to prevent using the string directly. |
The actions are exported now. import {reset} from 'redux-form';
...
dispatch(reset('myForm')); |
In the reducer, how would the |
Oh, I just realized that just dispatching the |
I'm dispatching |
the textarea component is not being clean using dispatch(reset('myform')) :( |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Say I have a login form that submits credentials to my api server. I don't want to call
this.reset()
in the components submit handler because I'm not sure yet whether the user logged in successfully.So my form component listens on something like auth.isLoggedIn from global state and in
componentWillReceiveProps
I check the value of this prop. IfnextProps.isLoggedIn
is true, I redirect and now I want to reset the form. The trouble is, resetting the form withincomponentWillReceiveProps
leads to an infinite loop. So the question I have is where is the best place to callreset
without getting into this issue?!Thanks!
The text was updated successfully, but these errors were encountered: