redux状态正在更改,但组件未重新呈现

时间:2019-03-03 16:41:18

标签: reactjs redux

我对重新渲染组件有疑问。商店正在更新,但是组件没有刷新-不知道为什么。我

这是减速器

const initialState = {
    actualCurrencies: [
        {
            id: "GBP",
            sell: null,
            buy: null
        }
    ]
}


        case "updateCurrencies":
        console.log(action.data);
            return {...state,
                actualCurrencies: [
                    {
                        id: "GBP",
                        sell: action.data[0].sell,
                        buy: action.data[0].buy
                    }
                ]
            }

这有什么问题?我想这是可变的问题,但是为什么呢?我正在使用spred操作,它可以正常工作。

1 个答案:

答案 0 :(得分:0)

这是我与商店的连接组件

    export default connect(state => 
    ({
        currencies: state.auth.currencies,
        money: state.auth.money
    }),
    { updateCurrencies }
)(BodyLogIn);

我在另一个组件中使用了它,但是没有数组,它正在工作。我需要在渲染中添加一些代码,以使他们知道某些更改吗?

相关问题