在EMACSsCRIPT 6代码中,如果我们使用
var raxios = axios.get(some_server_link).then(function()(response) {
.....
use response data
....
});我注意到我只能在函数中使用响应。有没有任何方法可以使用响应的信息超出此功能范围?
发布于 2017-04-18 16:22:30
您是否尝试过将响应设置为状态?
axios.get('/url')
.then(res => {
this.setState({ someKey: res.data });
}那么您应该能够在外部使用它,使用:
this.state.someKey;https://stackoverflow.com/questions/43477228
复制相似问题