0

When i trying to write something -> loosing focus on first onChange with redux-form ( Field Arrays ). v6.5.0

Method with render

const renderEmails = ({ fields, meta: { touched, error, submitFailed } }) => (
            <div className="col-xs-12">
                {fields.map((email, index) =>
                    <div key={index} className="fieldArray-container relative">
                        <div className="absolute-link left" style={indexStyle}>
                            {index + 1}
                        </div>
                        <button
                            type="button"
                            title="Remove rule"
                            className="btn btn-link absolute-link right"
                            style={removeButtonStyle}
                            onClick={() => fields.remove(index)}>
                            <i className="fa fa-times-circle" />
                        </button>
                        <Field
                            style={inputStyle}
                            name={`${email}.email`}
                            type="text"
                            component={Input}
                        />
                    </div>
                )}
                <div className="text-center"><button type="button" className="btn btn-link" onClick={() => fields.push({})}>+ Add Employee</button></div>
                {(touched || submitFailed) && error && <div className="alert alert-danger">{error}</div>}
            </div>
        );

Call fieldarray

<FieldArray name="employeeEmails" component={renderEmails} />
Андрей Гузюк
  • 2,134
  • 6
  • 29
  • 53

1 Answers1

0

Seems like duplicate. Using redux-form I'm losing focus after typing the first character

Need to hoist it up.

Community
  • 1
  • 1
Андрей Гузюк
  • 2,134
  • 6
  • 29
  • 53