React-刷新 Modal

React 设置 Key 刷新 Modal。

1
2
3
4
5
6
7
8
9
10
showFileModal = () => {
this.setState({
visible: true,
});
this.setState({myKey: Math.random()});
};
<Modal
key = {this.state.myKey}
visible={this.state.visible}
>