mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
Transfer 组件在render后,马上unmount会报setState错误 (#2206)
* Transfer 组件在render后,马上unmount会报setState错误 如题 * _t => timer
This commit is contained in:
parent
21fb73d4f2
commit
85141db724
@ -54,13 +54,17 @@ export default class TransferList extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
setTimeout(() => {
|
||||
this.timer = setTimeout(() => {
|
||||
this.setState({
|
||||
mounted: true,
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(...args) {
|
||||
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user