请教一个react优化问题,我们可以在shouldComponentUpdate中这样比较来避免重新渲染数据吗?比如我们通过JSON.stringify(),比较state数据
shouldComponentUpdate(nextProps, nextState) {
if(JSON.stringify(nextState) == JSON.stringify(this.state)){
return false
}
return true
}
展开
39