我有一个警报React组件,使用了Bootstrap类。
以下是组件代码:
import React, { Component } from 'react';
class Alert extends Component {
render() {
return (
<div>
<div className="alert alert-warning alert-dismissible" role="alert">
<button type="button" className="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
{this.props.text}
</div>
</div>
);
}
}
export default Alert;
它的功能很好,但我的问题是...
当我点击其中的关闭按钮时,如何使警报自动隐藏?