Reactjs ent)=>{ 让statusId=event.target.value; 此.setState(()=>({ selectedRole:statusId })) } handleSourceChange=(ev)=>{ 让statusId=ev.target.value; 此.setState(()=>({ selectedSourceRole:statusId })) } 渲染(){ log(this.state.follows); 返回( {/*页面内容*/} 销售人员仪表盘 今天的目标({this.state.utc.slice(0,10).replace(/-/g,'-')) 每周目标 本周迄今为止的奖金 已处理0/{this.renderLeads()}个线索 已处理0/{this.renderLeads()*5}个线索 来自潜在客户的0美元 0/{this.renderSales()}销售 0/{this.renderSales()*5}销售 销售收入0美元 0/{this.renderRatio()}关闭比率 0/{this.renderRatio()*5}闭合比率 利润分成0美元 需要跟进的潜在客户 {this.renderFollowActivities()} 添加活动 电话 电子邮件 现场聊天 领导 出售 {this.renderActivities()} ) } } 常量mapStateToProps=状态=>({ apiData:州政府活动, apiDat:state.targets, userDetails:state.userDetails }) 功能图DispatchToprops(调度){ 返回{ 行动:{ reqGetGlobalTargets:bindActionCreators(reqGetGlobalTargets,dispatch), reqGetFollowActivities:bindActionCreators(reqGetFollowActivities,调度), reqGetTherapistsTopProfiles:bindActionCreators(reqGetTherapistsTopProfiles,dispatch), reqFetchUserDetails:bindActionCreators(reqFetchUserDetails,dispatch), reqActionsUsers:bindActionCreators(reqActionsUsers,dispatch), } }; } 导出默认连接(mapStateToProps、mapDispatchToProps)(UserDashboard)

Reactjs ent)=>{ 让statusId=event.target.value; 此.setState(()=>({ selectedRole:statusId })) } handleSourceChange=(ev)=>{ 让statusId=ev.target.value; 此.setState(()=>({ selectedSourceRole:statusId })) } 渲染(){ log(this.state.follows); 返回( {/*页面内容*/} 销售人员仪表盘 今天的目标({this.state.utc.slice(0,10).replace(/-/g,'-')) 每周目标 本周迄今为止的奖金 已处理0/{this.renderLeads()}个线索 已处理0/{this.renderLeads()*5}个线索 来自潜在客户的0美元 0/{this.renderSales()}销售 0/{this.renderSales()*5}销售 销售收入0美元 0/{this.renderRatio()}关闭比率 0/{this.renderRatio()*5}闭合比率 利润分成0美元 需要跟进的潜在客户 {this.renderFollowActivities()} 添加活动 电话 电子邮件 现场聊天 领导 出售 {this.renderActivities()} ) } } 常量mapStateToProps=状态=>({ apiData:州政府活动, apiDat:state.targets, userDetails:state.userDetails }) 功能图DispatchToprops(调度){ 返回{ 行动:{ reqGetGlobalTargets:bindActionCreators(reqGetGlobalTargets,dispatch), reqGetFollowActivities:bindActionCreators(reqGetFollowActivities,调度), reqGetTherapistsTopProfiles:bindActionCreators(reqGetTherapistsTopProfiles,dispatch), reqFetchUserDetails:bindActionCreators(reqFetchUserDetails,dispatch), reqActionsUsers:bindActionCreators(reqActionsUsers,dispatch), } }; } 导出默认连接(mapStateToProps、mapDispatchToProps)(UserDashboard),reactjs,react-redux,state,liferay-6,Reactjs,React Redux,State,Liferay 6,组件将接收每次状态更改或状态更改时都会调用props,因此如果要停止复制,应执行以下操作: componentWillReceiveProps(nextProps, nextContext) { if (JSON.stringify(nextProps.someProps.items) !== JSON.stringift(this.state.items)){ // do something } } 基本上,您应该检查组件的道具和状态是否应该对这种情况做出反

组件将接收每次状态更改或状态更改时都会调用props
,因此如果要停止复制,应执行以下操作:

componentWillReceiveProps(nextProps, nextContext) {
        if (JSON.stringify(nextProps.someProps.items) !== JSON.stringift(this.state.items)){
// do something
         }
}
基本上,您应该检查组件的道具和状态是否应该对这种情况做出反应,然后真正呈现您的应用程序


希望有帮助

这能回答您的问题吗@阿格尼这是我做的正确的事情,它解决了问题。谢谢
componentWillReceiveProps(nextProps, nextContext) {
        if (JSON.stringify(nextProps.someProps.items) !== JSON.stringift(this.state.items)){
// do something
         }
}