k88hudson / k88hudson/react-formation

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

Open
#48 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
34
Forks
7
PR merge metrics
No merged PRs in 30d

Description

``` js
// child component
var Input = React.createClass({
mixins: [Formation.FormMixin],
render: function () {
return (



);
}
});

// 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 (

{
Object.keys(schema).map(function(formName) {
var props = schema[formName];
schema[formName].name = formName;
return (
{formName}
);
})
}
);
}
});

// page wrapper
var MyPage = React.createClass({
render: function() {
return (




);
}
});

```

And I got this warning on my browser console

``` 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? :grin:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.