Javascript NET中的函数永远无法访问-如何在render中调用简单的箭头函数?

Javascript NET中的函数永远无法访问-如何在render中调用简单的箭头函数?,javascript,asp.net,asp.net-mvc,reactjs,reactjs.net,Javascript,Asp.net,Asp.net Mvc,Reactjs,Reactjs.net,我正在安装我的第一个ReactJS.net应用程序,并在网站上遵循了教程 我在上面构建了更多,在我的App.jsx文件中有以下代码: let test = () => { console.log('called!'); return "<p>Testing</p>"; } var CommentBox = React.createClass({ render: function () { return (

我正在安装我的第一个ReactJS.net应用程序,并在网站上遵循了教程

我在上面构建了更多,在我的
App.jsx
文件中有以下代码:

let test = () => {
    console.log('called!');
    return "<p>Testing</p>";
} 

var CommentBox = React.createClass({
    render: function () {
        return (
            <div className="commentBox">

                Hello, world! I am a CommentBox.
                <test /> // tried both but neither worked
                {test}
      </div>
        );
    }
});

ReactDOM.render(
    <CommentBox />,
    document.getElementById('content')
);

test
函数就是这个,一个函数。JSX不知道该怎么办<代码>可能会实例化一个React组件。而
{test}
将插入一些javascript值。你的电话也没有。它在页面上粘贴一个函数,该函数不呈现也不执行

如果要调用
test
函数,可以像调用任何其他javascript函数一样调用它:
{test()}

// @hash v3-310AECBD0B84ED139C81E87801CA7DBDFA284566
// Automatically generated by ReactJS.NET. Do not edit, your changes will be overridden.
// Version: 3.3.0 (build 8c1c474) with Babel 6.7.7
// Generated at: 01-04-2018 17:37:43
///////////////////////////////////////////////////////////////////////////////
var test = function test() {
    console.log('called!');
    return "Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing ";
};

var CommentBox = React.createClass({
    displayName: "CommentBox",


    render: function render() {
        return React.createElement(
            "div",
            { className: "commentBox" },
            "Hello, world! I am a CommentBox.",
            React.createElement("test", null),
            test
        );
    }
});

ReactDOM.render(React.createElement(CommentBox, null), document.getElementById('content'));