Reputation: 795
var CommentList = React.createClass({
render: function () {
return (
<div className="commentList">
Hello, world!I am a CommentList.
</div>
);
}
});
var CommentBox = React.createClass({
render: function () {
return (
<div className="commentBox">
<h1>Comments</h1>
<CommentList /> //ERROR
</div>
);
}
});
React.render(
React.createElement(CommentBox, null),
document.getElementById('content')
);
With this code, I get the following error message: JSX element type 'CommentList' does not have any construct or call signatures.
The same code works with plain HTML/JS (following this tutorial: https://facebook.github.io/react/docs/tutorial.html)
I have no clue why TypeScript doesn't like it. Using Visual Studio 2013 with TS 1.6 (http://blogs.msdn.com/b/typescript/archive/2015/09/16/announcing-typescript-1-6.aspx)
Upvotes: 0
Views: 2354
Reputation: 275927
It works fine without error (screen shot from atom-typescript) :
Suggestions:
react.d.ts
included and try not to use the global versionReact
variable available (e.g. import React = require('react');
).Upvotes: 2