【发布时间】:2017-07-24 22:01:25
【问题描述】:
我正在尝试从我的渲染方法之外返回 jsx。它在没有 api 请求时工作,但是一旦我添加请求并添加回调,我就无法返回 jsx。我该怎么做呢? renderLocations 在我的渲染方法中被调用。
renderLocations() {
this.Geo((coord) => {
return this.state.location.map((location, index) => {
return (
<div>
{coord}
</div>
);
})
})
}
【问题讨论】:
-
这不是很明显吗?你从
renderLocations方法返回什么?返回内部回调不会从外部范围返回。