当我尝试在新选项卡中访问组件中的状态时,它使用 redux 显示未定义

时间:2021-06-08 14:22:22

标签: redux react-redux redux-thunk

我没有放我所有的代码,因为代码很长,所以我只放了redux代码。请帮我解决问题

那是我的 redux 商店

$ awk -f tst.awk file
6 0 6 4605 6 0
5 4473 5 4270 5 0
4 4394 4 4053 4 0
3 4386 3 3909 3 3150
2 4750 2 4267 2 3457
1 5963 1 5362 1 4795

这是我尝试通过的派遣

let businessAreaData ;


const businessDetails = (state=businessAreaData,action)=>{
    console.log( 'User action is here : ', action )
    
    if(action.type === 'Add_Business_Area_Details'){
        state = action.payLoad;
    }

    console.log("State from the sever set",state)
    return state;
}

export  default  businessDetails;

这是我尝试访问状态的组件,但它显示未定义

props.changeBusinessArea( 'kkk' );

const mapDispatchToProps = (dispatch) => {
    return {
        changeBusinessArea: 
       (businessData)=>dispatch({type:'Add_Business_Area_Details',payLoad:businessData})
    }
}

export default  connect(null,mapDispatchToProps)(BusinessAreaTable);

0 个答案:

没有答案