[英]redux state is changing but component is not re-rendering
我在重新渲染组件时遇到问题。 商店正在更新,但是组件没有刷新-不知道为什么。 一世
这是减速器
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操作,它可以正常工作。
那是我与商店的连接组件
export default connect(state =>
({
currencies: state.auth.currencies,
money: state.auth.money
}),
{ updateCurrencies }
)(BodyLogIn);
我在另一个组件中使用了它,但是没有数组,它正在工作。 我是否需要在渲染中添加一些代码,以便知道某些更改已做出反应?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.