Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.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
Node.js 呈现JS视图时出现语法错误_Node.js_Express_Reactjs - Fatal编程技术网

Node.js 呈现JS视图时出现语法错误

Node.js 呈现JS视图时出现语法错误,node.js,express,reactjs,Node.js,Express,Reactjs,作为我的node.js应用程序中EJS的替代引擎。无论如何,我在这里使用了这个示例: var React=require('React'); var hellomemessage=React.createClass({ render:function(){ 返回Hello{this.props.name}; } }); module.exports=HelloMessage; 但是我得到了这个错误:[SyntaxError:D:\Data\ytko\elbp\views\index.jsx:5

作为我的node.js应用程序中EJS的替代引擎。无论如何,我在这里使用了这个示例:

var React=require('React');
var hellomemessage=React.createClass({
render:function(){
返回Hello{this.props.name};
}
});
module.exports=HelloMessage;
但是我得到了这个错误:[SyntaxError:D:\Data\ytko\elbp\views\index.jsx:5 返回; ^
意外标记您是否已将其添加到应用程序中?如本步骤所示,是的,所有设置都已完成。您是否可以提供所获得的完整错误?我猜您没有将JSX转换为JS.Hmm,很有趣。无论如何,请查看一下……尝试
render:function(){return(Hello{this.props.name});}
var React = require('react');

var HelloMessage = React.createClass({
  render: function() {
    return <div>Hello {this.props.name}</div>;
  }
});

module.exports = HelloMessage;