reactjs – How to reset initial value in redux form

reactjs – How to reset initial value in redux form

import {reset} from redux-form;

...

dispatch(reset(myForm));  // requires form name

Harshas answer is correct, but you can also call this.props.reset(), which already knows your form name, from inside your decorated form component.

You can see it in action on the Clear Values button in the Simple Example.

reactjs – How to reset initial value in redux form

TLDR: set enableReinitialize: true on your form

I had this same problem recently and came across this post, with none of the answers working. Finally found the solution so hopefully this will help someone else. the problem is those initial values not getting reset when you reset the form. here is a github issue asking about it, and here is the current documentation about it

Leave a Reply

Your email address will not be published.