所以我有Rails应用程序,我安装了react Rails gem,设置它并try 运行测试应用程序.
刚安装,当我试图运行hello world程序时,出现了以下错误:
未捕获引用错误:未定义ReactDOM
这是我的react :
var HelloWorld = React.createClass({
render: function() {
return (
<p>
Hello, <input type="text" placeholder="Your name here" />!
It is {this.props.date.toTimeString()}
</p>
);
}
});
setInterval(function() {
ReactDOM.render(
<HelloWorld date={new Date()} />,
document.getElementById('example')
);
}, 500);
它保存在/app/assets/javascripts/components/test中.js.jsx文件.
带有Ruby 2.2.3的Rails 4.2.4