获得徽章 0
最近业务经常碰到这种结构
this.state = {
a: {
b: {
c: {
d: 1
}
}
}
}
以前我
const _a = _.cloneDeep(this.state.a)
_a.b.c.d = 2
this.setState({a: _a})
现在我
this.a = {
b: {
c: {
d: 1
}
}
}
this.a.b.c.d = 2
this.forceUpdate()
我知道这么做你们要喷我
但我就想问
还有人跟我一样吗
this.state = {
a: {
b: {
c: {
d: 1
}
}
}
}
以前我
const _a = _.cloneDeep(this.state.a)
_a.b.c.d = 2
this.setState({a: _a})
现在我
this.a = {
b: {
c: {
d: 1
}
}
}
this.a.b.c.d = 2
this.forceUpdate()
我知道这么做你们要喷我
但我就想问
还有人跟我一样吗
展开
1
点赞
前端
人工智能