Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React教程-无法读取属性';toString';未定义的_Reactjs - Fatal编程技术网

Reactjs React教程-无法读取属性';toString';未定义的

Reactjs React教程-无法读取属性';toString';未定义的,reactjs,Reactjs,我需要在第二天学习React,并从官方教程开始。在我的代码达到这种状态之前,一切都很好,在这种状态下,我遇到了一个错误,并且不确定如何避免它: </head> <body> <div id="content"></div> <!-- script type="text/babel" src="scripts/example.js"></script --> <script type=

我需要在第二天学习React,并从官方教程开始。在我的代码达到这种状态之前,一切都很好,在这种状态下,我遇到了一个错误,并且不确定如何避免它:

</head>
    <body>
    <div id="content"></div>
     <!-- script type="text/babel" src="scripts/example.js"></script -->
     <script type="text/babel">
       var CommentBox = React.createClass( {
          render: function() {
            return (
              <div className = "commentBox">
                <h1>Comments</h1>
                <CommentList />
                <CommentForm />
                <Comment />
              </div>
              );
         }
       });

          var CommentList = React.createClass({
            render: function () {
              return (
               <div className = "commentList">
                  <Comment author = "Michael Johnson">This is one 
                      comment</Comment>
                  <Comment author = "Daniel Kammer">This is the 'second' 
                      comment</Comment>
                  </div>
               );
            }
          });

           var CommentForm = React.createClass({
            render: function () {
              return (
                <div className = "commentForm">
                   Hello, world! I am a CommentForm.
                </div>
                );
            }
          });

          var Comment = React.createClass({
           var md = new Remarkable();
           render: function () {
          return (
            <div className = "comment">
              <h2 className = "commentAuthor">
                {this.props.author}
              </h2>
            *** ERROR IS GENERATED BY THE BELOW STATEMENT ***
                {md.render(this.props.children.toString())}
            </div>
            );
        }
      });

var CommentBox=React.createClass({
render:function(){
返回(
评论
);
}
});
var CommentList=React.createClass({
渲染:函数(){
返回(
这是一个
评论
这是“第二次”
评论
);
}
});
var CommentForm=React.createClass({
渲染:函数(){
返回(
你好,世界!我是一个评论人。
);
}
});
var Comment=React.createClass({
var md=新显著();
渲染:函数(){
返回(
{this.props.author}
***错误由下面的语句生成***
{md.render(this.props.children.toString())}
);
}
});
本教程的其余部分继续使用md.render语句-因此我需要了解如何解决此错误,它可能是由
ComentBox
组件中的
引起的。
Comment
组件正常工作需要子组件,但closed标记没有子组件(
this.prop.Children
为null或未定义=>方法
toString
未声明)

可能是由
ComentBox
组件中的
引起的。
Comment
组件的正常工作需要子组件,但是closed标记没有子组件(
this.prop.Children
为null或未定义=>method
toString
未声明)

控制台中“this.props.Children”的输出是什么?那么什么是显著的呢?请提供更多信息并链接到教程。控制台中“this.props.children”的输出是什么?那么什么是显著的呢?请提供更多信息并链接到教程。