Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using field choices raises React warning (unique key missing) #68

Closed
Ismael opened this issue Mar 9, 2015 · 3 comments
Closed

Using field choices raises React warning (unique key missing) #68

Ismael opened this issue Mar 9, 2015 · 3 comments
Labels

Comments

@Ismael
Copy link

Ismael commented Mar 9, 2015

The following code produces this warning: "Each child in an array should have a unique "key" prop. Check the render method of FormRow. See http://fb.me/react-warning-keys for more information."

var React = require("react");
var forms = require("newforms");
var IPIN = forms.Form.extend({
    device: forms.ChoiceField({choices: ["eth0", "eth1"]}),
});
var IPINform = new IPIN();

var Thing = React.createClass({
  getInitialState: function(){
    return {form: IPINform};
  },
  render: function(){
    return (
            <form>
                <forms.RenderForm form={this.state.form} ref="ipin" />
                <button>submit</button>
            </form>
        );
  }
});
var r = React.render(<Thing/>, document.body);
@insin
Copy link
Owner

insin commented Mar 9, 2015

Must be the <option>s, should be easy to fix.

@insin insin added the Defect label Mar 9, 2015
@Ismael
Copy link
Author

Ismael commented Mar 9, 2015

I'd guess this is related:
" Warning: Use the defaultValue or value props on instead of setting selected on ."

@insin
Copy link
Owner

insin commented Mar 9, 2015

That one depends on facebook/react#1398 - we currently need to set selected manually to support server-side rendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants