wangdicoder / react-native-Gank

A cross platform App which shows the contents from gank.io
550 stars 96 forks source link

请问es6语法中同名函数是什么意思 #4

Closed qq273681448 closed 7 years ago

qq273681448 commented 7 years ago

我在您的项目里看到 dao.fetchLocalData(date).then((localData) => { //Toast.show('local', {position: px2dp(-80)}); dispatch(receiveData(localData, date)); }, (localData) => { //Toast.show('local', {position: px2dp(-80)}); dispatch(onlyFetchLocalData(getYesterdayFromDate(date))); }); 其中 (localData)有2个,这在代码中怎么执行的,谢谢。

wangdicoder commented 7 years ago

这个是Promise,前面是resolve返回的值,后面是reject返回的值。后一个localData其实没有当作参数使用。这两个参数名字可以随便起

qq273681448 commented 7 years ago

非常感谢