Open StarHosea opened 7 years ago
您好,刚接触Redux,React Native。 使用您的库如果异步Action发生错误,RN会warning : Possible Unhandled Promise Rejection。 发现 createAsyncAction 中,下面一行代码注释掉就没有warning了。
Possible Unhandled Promise Rejection
createAsyncAction
function createAsyncAction(type, payloadCreator, metaCreator) { ..... return promise.then(value => { }, e => { dispatch( failedAction(e, getAsyncMeta(metaCreator, e, ASYNC_PHASES.FAILED)) ); return Promise.reject(e);//这里为什么还要返回错误呢 }); }
可以参考这两个issue的回答:
https://github.com/kpaxqin/redux-action-tools/issues/3 https://github.com/kpaxqin/redux-action-tools/issues/2
看来不少人有这个疑惑,我稍后考虑补全文档和示例
您好,刚接触Redux,React Native。 使用您的库如果异步Action发生错误,RN会warning :
Possible Unhandled Promise Rejection
。 发现createAsyncAction
中,下面一行代码注释掉就没有warning了。