How do you create multiple forms on the same page with redux-forms v6? : <p>I have a simple todo app in which my redux store contains an array of 'todos'. My 'Todo' component maps over every 'todo' in the store and renders a 'TodoForm' component that uses redux-forms v6.</p>

<p>As it is now, every 'todo' shares the same form name/key, so every time I input something in the 'title' Field, it changes the 'title' of every todo. I found a work around by using unique Field names, but I fear it's going to over complicate things as the app grows, and would prefer to use unique Form names so every field can have the same name without interfering with the other forms </p>

<p>(TodoForm1, TodoForm2, TodoForm3 can all have a unique 'title' Field instead of TodoForm containing 'title1', 'title2', 'title3' Fields).</p>

<p>I tried accessing the TodoForm's props so I could set each form's key as the component's unique id, but it doesn't seem like the component receives props that early. </p>

<p>I also tried making an immediately invoked function where it spits out a random number, and using that number as the form's name, but that also didn't work.</p>

<p>How can I can map through all my todos and render a v6 redux-form with a unique form key?</p>

<p>Here's a picture of the app, console, and redux devtools. There's 3 'todos', but there's only one form that connects them all, todo-926, even though each form key should have been randomly generated in an immediately invoked function:</p>

<p><a href="https://i.stack.imgur.com/fWSij.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fWSij.png" alt="Todo Conundrums"></a></p>

<p>HomePageMainSection.index.js</p>

<pre><code>renderTodos(todo) {
    if (!todo) {
      return &lt;div&gt;No Todos&lt;/div&gt;;
    }
    return (
      &lt;div key={todo.get('id')}&gt;
        &lt;Todo
          todo={todo}
          updateTodo={this.props.updateTodo}
          deleteTodo={this.props.deleteTodo}
        /&gt;
      &lt;/div&gt;
    );
  }

  render() {
    if (!this.props.todos) {
      return &lt;div&gt;No Todos&lt;/div&gt;;
    }

    return (
      &lt;div className={styles.homePageMainSection}&gt;
        &lt;h1&gt;Hey I'm the Main Section&lt;/h1&gt;
        &lt;div&gt;
          {this.props.todos.get('todos').map(this.renderTodos)}
        &lt;/div&gt;
      &lt;/div&gt;
    );
  }
</code></pre>

<p>Todo.index.js:</p>

<pre><code>  renderTodo() {
    if (this.state.editMode) {
      return (
        &lt;TodoForm
          todo={this.props.todo} changeTodoEditMode={this.changeTodoEditMode}
          updateTodo={this.props.updateTodo}
        /&gt;
      );
    }

    return (
      &lt;div className={styles.Todo} onClick={this.changeTodoEditMode}&gt;
        &lt;div className="card card-block"&gt;
          &lt;h4 className="card-title"&gt;{this.props.todo.get('author')}&lt;/h4&gt;
          &lt;p className="card-text"&gt;{this.props.todo.get('title')}&lt;/p&gt;
          &lt;i
            className={`${styles.deleteIcon} btn btn-danger fa fa-times`}
            onClick={this.deleteTodo}
          &gt;&lt;/i&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    );
  }

  render() {
    return (
      &lt;div className="col-xs-6 col-sm-4"&gt;
        {this.renderTodo()}
      &lt;/div&gt;
    );
  }
</code></pre>

<p>TodoForm.index.js:</p>

<pre><code>class TodoForm extends React.Component { // eslint-disable-line react/prefer-stateless-function
  constructor(props) {
    super(props);

    this._handleSubmit = this._handleSubmit.bind(this);
  }

  _handleSubmit(formData) {
    console.log('');
    console.log('OG: ', this.props.todo)
    console.log('formData: ', formData);
    const data = this.props.todo.update('title', formData.get('title'));
    console.log('data: ', data);
    console.log('');
    // this.props.updateTodo(data);
  }

  render() {
    const { handleSubmit, pristine, submitting } = this.props;
    return (
      &lt;form className={`${styles.todoForm} card`} onSubmit={handleSubmit(this._handleSubmit)}&gt;

        &lt;div className="card-block"&gt;
          &lt;label htmlFor="title"&gt;{this.props.todo.get('title')}&lt;/label&gt;
          &lt;div className={'form-group'}&gt;
            &lt;Field name={`title`} component="input" type="text" placeholder="Enter new title" className="form-control" /&gt;
          &lt;/div&gt;
        &lt;/div&gt;

        &lt;div className="card-block btn-group" role="group"&gt;
          &lt;button
            className="btn btn-success"
            type="submit"
            disabled={pristine || submitting}
          &gt;
            Submit
          &lt;/button&gt;
          &lt;button
            className="btn btn-danger fa fa-times"
            onClick={this.props.changeTodoEditMode}
          &gt;
          &lt;/button&gt;
        &lt;/div&gt;

      &lt;/form&gt;
    );
  }
}

const randomNum = (() =&gt; {
  const thing = Math.floor(Math.random() * 1000) + 1;
  console.log('thing: ', thing);
  console.log('notThing: ', TodoForm.props);
  return thing;
})();

export default reduxForm({
  form: `todo-${randomNum}`,
})(TodoForm);
</code></pre>
