title: How can I replace fields filled out by local state and set them with a Redux-Form instead?
body: <p>I have a form which comes to the UI in a modal. It is a form which is already filled out since it is to edit the information that is already there. </p>
  
  <p>So I am fetching the information on that form on a <code>componentDidMount</code>:</p>
  
  <pre><code>componentDidMount() {
      const { passengerInfo } = this.props;
  
      if (passengerInfo) {
        this.setState({
          id: passengerInfo.id,
          address: passengerInfo.address,
        });
      }
    }
  </code></pre>
  
  <p>Then I set that info on the fields:</p>
  
  <pre><code>   const addressField = () =&gt; (
        &lt;AddEditFormInputs
          inputName="address"
          onChangeText={address =&gt; this.setState({ address })}
          textStateValue={address}
        /&gt;
      );
      ...
      &lt;Field name="address" component={addressField} /&gt;
  </code></pre>
  
  <p>Above, <code>textStateValue</code> is the value of the input, so, if <code>address</code> input has information, it will print it when the form comes to the UI, and the same for the other fields.</p>
  
  <p>The problem I am having is that if I close and open again that modal, then the field gets restored. I guess it is because I am setting the state on a <code>componentDidMount</code>. </p>
  
  <p>So, what can I do to keep the state of the form using a Redux-Form?</p>
  
  <p>As you see I am already using Redux-Form here -> <code>&lt;Field name="address" component={addressField} /&gt;</code> but I need some</p>
  
  <p><a href="https://monosnap.com/file/H2QSNj7jabblEWFRO0Z9peJGTjdr7i" rel="nofollow noreferrer">I recorded a video for you to have an idea of how the modal opens with the form already filled out</a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Something I forgot to post is that I also can set this fields information with data coming from a redux-store. Like this:</p>
  
  <pre><code>  componentDidMount() {
      const {
        passengerInfo,
      } = this.props;
  
      if (passengerInfo) {
        editPassengerDataActionActionHandler({
          id: passengerInfo.id,
          address: passengerInfo.address,
        });
    }
  </code></pre>
  
  <p>With that above I am trying to change the information as well and it will get restored to the original values if I don't submit the form.</p>