反応をアプリに接続しようとしています。rails-react を使用した Rails アプリです (問題の一部ではないと思いますが)。私は現在、非常に単純な 1 コンポーネントのセットアップを使用しています。
// react_admin.js.jsx
/** @jsx React.DOM */
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
Hello, world! I am a CommentBox.
</div>
);
}
});
React.render(
<CommentBox />,
document.getElementById('content')
);
私のhtmlファイルには以下が含まれています:
<body>
<div id="content"></div>
<script src="/assets/react.js?body=1"></script>
<script src="/assets/react_admin.js?body=1"></script>
</body>
次のように、rails-react が react_admin.js.jsx を react_admin.js に変換していることがわかります。
/** @jsx React.DOM */
var CommentBox = React.createClass({displayName: 'CommentBox',
render: function() {
return (
React.DOM.div({className: "commentBox"},
"Hello, world! I am a CommentBox."
)
);
}
});
React.render(
CommentBox(null),
document.getElementById('content')
);
ただし、chrome は Render.react() 呼び出しで「Uncaught TypeError: undefined is not a function」を発生させており、「(」と「CommentBox(null)」の間に表示されます。
誰かが私が間違っていることを教えてもらえますか?