I'm trying to pass property to react-select element from other component but I get following error
Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's
render
method, or you have multiple copies of React loaded
I lookup online and fb documentation regading the error here https://gist.github.com/jimfb/4faa6cbfb1ef476bd105
And tried the possible solutions, but still did not fix the issue.
I'm using react
ver 15.1
and the react-select
is in 1.00 beta
version
Here's the sample code:
In my app.js
:
var options = [
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' }
];
function logChange(val) {
console.log("Selected: " + val);
}
ReactDOM.render(
<some.myDiv><span><some.ffff
options={options}
onChange={logChange}
key={5}
/></span></some.myDiv>,
document.getElementById('example')
);
In my resuable.js
:
window.some = {
"ffff":React.createClass({
render: function() {
return (<Select
{...this.props}
/>);
}
}),
myDiv:React.createClass({
render: function() {
return (<div
{...this.props}
/>);
}
}),
}