减速器返回状态,但未调用组件getDerivedStateFromProps

时间:2019-11-27 09:06:59

标签: react-native reducers

今天,我处理错误情况,当多次返回错误时,未调用组件getDerivedStateFromProps,但reducer处于返回状态。是什么原因?

 //here is the reducer error code, I use the console.log("the reducer"), find here return 
 //data
 case ERROR:
                {
                    console.log("the error state reducer returns")
                    return {
                        ...state,
                        isSuccess:false,
                        error:"load data info"
                    };
                }
                break;

0 个答案:

没有答案