所以我刚开始学习ReactJs,并在前20分钟遇到了这个错误:
using (XrmServiceContext ctx = new XrmServiceContext(xrmObjects.Service))
{
Xrm.InvoiceDetail image = xrmObjects.PluginContext.PreEntityImages["invoicedetail"].ToEntity<Xrm.InvoiceDetail>();
try
{
ctx.LoadProperty(image, "invoice_details");
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException($"Error retrieving invoice details' invoice: {ex.Message}");
}
}
我的代码如下:
browser.js:62790 Uncaught SyntaxError: embedded: Unexpected token (9:3)
7 | </div>
8 | },
> 9 | )};
| ^
10 | React.render(<HelloWorld />, document.body);
11 |
环顾四周,没有发现任何修复过的东西。任何想法?我确信这是一件简单的事情,但我刚刚开始。
提前致谢!
答案 0 :(得分:2)
您的括号稍微偏离,请参阅组件定义的最后一行:
var HelloWorld = React.createClass({
render: function() {
return <div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
}
});
答案 1 :(得分:2)
您没有正确包装渲染方法的结束括号。您的代码应如下所示:
<!DOCTYPE html>
<html>
<head>
<script src="https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.3284- 6/11057025_805715566176382_77439371_n.js"></script>
<!-- version 0.13.3.min.js-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
<title>React</title>
</head>
<body>
<script type="text/babel">
var HelloWorld = React.createClass({
render: function() {
return (<div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>);
}
});
React.render(<HelloWorld />, document.body);
</script>
</body>
</html>
最好的运气:)
答案 2 :(得分:0)
您需要更改括号
var HelloWorld = React.createClass({
render: function() {
return <div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
}
});