UNPKG

479 BJavaScriptView Raw
1import React, { Component } from 'react';
2import Alert from './Alert';
3
4class UncontrolledAlert extends Component {
5 constructor(props) {
6 super(props);
7
8 this.state = { isOpen: true };
9 this.toggle = this.toggle.bind(this);
10 }
11
12 toggle() {
13 this.setState((prevState) => ({ isOpen: !prevState.isOpen }));
14 }
15
16 render() {
17 return (
18 <Alert isOpen={this.state.isOpen} toggle={this.toggle} {...this.props} />
19 );
20 }
21}
22
23export default UncontrolledAlert;