Browse Source

Transfer 组件在render后,马上unmount会报setState错误 (#2206)

* Transfer 组件在render后,马上unmount会报setState错误

如题

* _t => timer
pull/2231/head
Mr.Tone 9 years ago
committed by afc163
parent
commit
8324a2c3c1
  1. 6
      components/transfer/list.jsx

6
components/transfer/list.jsx

@ -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…
Cancel
Save