【发布时间】:2016-03-14 12:07:13
【问题描述】:
我会非常感激谁能帮我解决这个问题 我有这个:
var Country = React.createClass({
render:function(){
return(
<nav>
<h2>list of country:</h2>
{ this.props.country}
</nav>
)
}
})
var Jugador =React.createClass({
componentWillMount: function(){
var pais;
var self = this;
$.getJSON("https://restcountries.eu/rest/v1/all", function(data){
for(pais in data)
{
console.log(pais, data[pais].name);
return(
<Country key={i} country={self.render(data[pais].name)}> </Country>
)
}
})
},
})
它不起作用,并出现此错误
未捕获的不变违规:createClass(...):类规范必须实现 render 方法。
【问题讨论】:
-
Jugador 没有渲染方法。它是一个反应组件吗?
标签: javascript json reactjs