I created a Rails application and installed react-rails . I also installed browserify-rails to help me manage external reaction packages.
All of my setup works well, but when I try to use the react-bootstrap batch component of the package, I get a firebug error that seems to block the execution of all other js. The error is being read:
Unopened invariant violation: addComponentAsRefTo (...): only ReactOwner can have links ....
I tried many possible solutions, but no luck. I do not understand why I get the error and why this only happens on certain components, such as <Modal />. If I use the usual html modal, there are no errors. Here is my setup:
package.json
{
"name": "my_project",
"devDependencies": {
"browserify": "^13.1.0",
"browserify-incremental": "^3.1.1",
"reactify": "^1.1.1"
},
"license": "MIT",
"engines": {
"node": ">= 0.10"
},
"dependencies": {
"react": "^15.3.2",
"react-bootstrap": "^0.30.3",
"react-dom": "^15.3.2"
}
}
application.js
var React = window.React = global.React = require('react');
var ReactDOM= window.ReactDOM = global.ReactDOM = require('react-dom');
application.rb
...
config.browserify_rails.commandline_options = "-t reactify --extension=\".js.jsx\""
...
components.js
// Setup app into global name space for server rendering
var app = window.app = global.app = {};
var MyComponent = require('./components/my_component');
app.MyComponent = MyComponent;
my_component.js.jsx
var Modal = require('react-bootstrap').Modal;
var MyComponent = React.createClass({
render() {
return (
<Modal show={true}><h1>I'm working</h1></Modal>
)
}
});
module.exports = MyComponent;
I am very new to reacting and therefore I am not sure if this error has anything to do with my setup or if it is something else?