我遇到错误:未捕获的SyntaxError:意外的令牌<< / p>
它位于第91行,它是:渲染函数中的“ return(”。
我没有发现任何错误。有什么想法吗?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
var TableExample = React.createClass({
getInitialState: function () {
// For testing.
console.log("In getInitialState.");
return {
Country: []
};
},
componentDidMount: function () {
// For testing.
console.log("In componentDidMount.");
$.ajax({
url: this.props.url,
dataType: 'json',
success: function(data) {
this.setState({
Country: data
});
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
}.bind(this)
});
},
render: function ()
{
// For testing.
console.log("In render.");
return ( <table>
{
this.state.Country.map(function (item, key)
{
return ( <tr key = { key } >
<td> { item.CountryID } </td>
<td> </td>
<td> { item.CountryName } </td>
</tr>
)
})
} </table> );
}
});
ReactDOM.render(<TableExample url = "/Home/GetName"/>,
document.getElementById ('container'));