Redux form pre populated data

Viewed 4167

I am using a redux form, on load of the component I am getting values for my text fields from an api response, when I have these values populated and submitted as I have not touched the fields - i am seeing validation errors - like they are empty - how to pass these existing values to props?

const emailValfromapi = this.props.data && this.props.data.email ? this.props.data.email : [];
    const { handleSubmit, fields: { email, abc, def, etc } } = this.props;
            <fieldset className="form-group">
                          <div className="input-wrapper">
                            <input value={emailValfromapi} id="email" {...email} type="email" className={email.touched && email.error ? 'error-red' : ''} required />
                            <label className="input-label" htmlFor="Email">To</label>
                            { email.touched && email.error && <div className="alert-danger"> { email.error } </div> }
                          </div>
                        </fieldset>
1 Answers
Related