Abhilash Muttalli
Abhilash Muttalli

Reputation: 1369

Warning: Unknown props `input`, `meta` on <input> tag. Remove these props from the element

i am trying to create form using redux-form but i am getting a warning and an error in which i am not able to rectify it. here are those warning and error: 1.Warning: Unknown props input, meta on tag. Remove these props from the element. 2.Uncaught Error: input is a void element tag and must neither have children nor use dangerouslySetInnerHTML. Check the render method of bound createElement.

This is my code:

import React, { Component } from 'react';
import { reduxForm,Field } from 'redux-form';
const  { DOM: { input, select, textarea } } = React;


class Createstudent extends Component {
  render() {
    const { handleSubmit } = this.props;
    return (
      <form onSubmit={handleSubmit}>
        <div>
          <label>First Name</label>
          <Field name="firstName" component={input} type="text"/>
        </div>
        <div>
          <label>Last Name</label>
          <Field name="lastName" component={input} type="text"/>
        </div>
        <div>
          <label>Email</label>
          <Field name="email" component={input} type="email"/>
        </div>
        <button type="submit">Submit</button>
      </form>
    );
  }
}

// Decorate the form component
Createstudent = reduxForm({
  form: 'contact' // a unique name for this form
})(Createstudent);

export default Createstudent;

Upvotes: 2

Views: 2003

Answers (1)

Chris
Chris

Reputation: 58202

Apparently this is an outstanding issue with the docs. A currently open github issue is following it:

https://github.com/erikras/redux-form/issues/1952

The correct, updated examples can be found here:

http://redux-form.com/6.4.1/examples/react-widgets/

Upvotes: 2

Related Questions