I'm currently trying to get some ReactJS-stuff (from different tutorials) to be rendered on server-side using 'ReactJS.NET'.
However, I always get the following message:
Could not find a component named 'CommentBox'. Did you forget to add it to App_Start\ReactConfig.cs?
Looking at the code here it seems to be pretty straight-forward.
My ReactConfig.cs:
public static class ReactConfig
{
public static void Configure()
{
ReactSiteConfiguration.Configuration
.AddScript("~/Scripts/dist/CommentBox.js");
}
}
I can't see the point what I am doing wrong here as I thought I simply need to add the (via webpack) generated CommentBox.js to the config and done.
In my View I simply try calling @Html.React("CommentBox",new {}) at which point the exception is thrown.
This is the code which can be found in the generated javascript-file:
var CommentBox = (function (_super) {
__extends(CommentBox, _super);
function CommentBox() {
return _super !== null && _super.apply(this, arguments) || this;
}
CommentBox.prototype.render = function () {
return __WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("div", { className: "commentBox" },
__WEBPACK_IMPORTED_MODULE_0_react__["createElement"]("h1", null, "Comment-Box"),
__WEBPACK_IMPORTED_MODULE_0_react__["createElement"](CommentForm, null),
__WEBPACK_IMPORTED_MODULE_0_react__["createElement"](CommentList, null));
};
return CommentBox;
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]));