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

"Contexts differ" warning when owner and parent of a child component differ #48

Open
mmmavis opened this issue Oct 13, 2015 · 4 comments

Comments

@mmmavis
Copy link
Contributor

mmmavis commented Oct 13, 2015

// child component
var Input = React.createClass({
  mixins: [Formation.FormMixin],
  render: function () {
    return (
      <fieldset>
        <input blah blah blah>
      </fieldset>
    );
  }
});

// form
var Form = Formation.CreateForm({
  getSchema: function () {
    return {
      "fullname": {
        required: true,
        label: "Full Name"
      }
    };
  },
  onSuccess: function (data) {
    console.log(data);
  },
  render: function () {
    var schema = this.getSchema();
    return (
    <form and_its_attributes>
      {
        Object.keys(schema).map(function(formName) {
          var props = schema[formName];
          schema[formName].name = formName;
          return (
            <Input {...props} key={formName}>{formName}</Input>
          );
        })
      }
    </form>);
  }
});

// page wrapper
var MyPage = React.createClass({
  render: function() {
    return (
      <div className="page-wrapper">
         <FringeEventForm/>
      </div>
    );
  }
});

And I got this warning on my browser console

"Warning: owner-based and parent-based contexts differ 
(values: `[object Object]` vs `[object Object]`) for key (reactFormation) 
while mounting Input (see: http://fb.me/react-context-by-parent)"

Any suggestions on how I can work around my code to fix this? 😁

@k88hudson
Copy link
Owner

@mmmavis what version of react are you using?

@mmmavis
Copy link
Contributor Author

mmmavis commented Oct 22, 2015

Hi @k88hudson , it's React 0.13.2

if it helps, this is where I used react-formation on: mozilla/mozillafestival.org#266 😬

@k88hudson
Copy link
Owner

If you upgrade to 13.3 it will fix the issue, are you able to do this?

@mmmavis
Copy link
Contributor Author

mmmavis commented Oct 28, 2015

@k88hudson i'll give it try and let you know 👍

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

No branches or pull requests

2 participants