Facebook's react.js -- object is not a function
Going along Facebook's read.js tutorial, I get this error:
Uncaught TypeError: Property 'CommentList' of object [object Object] is
not a function
In fact react.js's own examples page has:
Uncaught TypeError: object is not a function
Can anyone explain the correct usage?
My progress in Tutorial
Import the following two javascripts:
http://fb.me/react-0.4.1.js http://fb.me/JSXTransformer-0.4.1.js
The HTML is one line:
<div id="content"></div>
And the javascript or rather <script type="text/jsx"> looks like this:
var CommentBox = React.createClass({
render: function() {
return (
<div class="commentBox">
<h1>Comments</h1>
<CommentList />
<CommentForm />
</div>
);
}
});
React.renderComponent(
<CommentBox />,
document.getElementById('content')
);
var CommentList = React.createClass({
render: function() {
return (
<div class="commentList">
<Comment author="Pete Hunt">This is one comment</Comment>
<Comment author="Jordan Walke">This is *another* comment</Comment>
</div>
);
}
});
No comments:
Post a Comment