I'm working to build the redux-form below to collect emails as user input. The fields should all have the same name="email"
The problem is when the component renders, and I focus and type in one field, all the fields instantly update with the latest value from the first input field. All three of the fields seem to be tied together.
With redux-form, how do I enable the form to have inputs with the same name?
import React from 'react';
import { Field, reduxForm } from 'redux-form';
import {connect} from 'react-redux';
class InvitePage extends React.Component {
handleSubmit(data) {
console.log(data)
}
render() {
return (
<div>
<h1>Invites</h1>
<form onSubmit={this.props.handleSubmit(this.handleSubmit.bind(this))}>
<div>
<label>Email address</label>
<div>
<Field
name="email"
component="input"
type="email"
placeholder="Email"
/>
</div>
<div>
<Field
name="email"
component="input"
type="email"
placeholder="Email"
/>
</div>
<div>
<Field
name="email"
component="input"
type="email"
placeholder="Email"
/>
</div>
</div>
<div>
<button type="submit">Submit</button>
</div>
</form>
</div>
);
}
}
InvitePage = reduxForm({
form: 'InvitePage'
})(InvitePage);
export default InvitePage;