React Native中的=>

2017-09-26  本文已影响0人  Grail_Oosaki

表达式

如:

fetch(query)

.then(response=>response.json())

.then(json=>this._handleResponse(json.response))

.catch(error=>this.setState({

isLoading: false,

message: 'Something bad happended' + error

})

);

.then(response=>response.json())

.then(json=>this._handleResponse(json.response))

相当于

.then(function(response){response.json();})

.then(function(json){this._handleResponse(json.response);})

上一篇 下一篇

猜你喜欢

热点阅读