Добрый день!
Подскажите, пожалуйста. Где у меня ошибка ?
import * as React from 'react';
import Dialog from '@material-ui/core/Dialog';
import './index.scss';
export default class Popup extends React.Component {
public constructor(props): void {
super(props);
this.state = {
open: !!this.props.open,
};
}
getDerivedStateFromProps(nextProps) {
if (nextProps.open !== this.props.open) {
this.setState({
open: nextProps.open,
});
}
}
public handleClose() {
this.setState({ open: !this.props.open });
console.log(handleClose)
}
public render(): React.ReactNode {
return (
<Dialog onClose={this.handleClose.bind(this)} open={this.props.open} value={this.state.open}>
<div className="popup">
<div className="popup__closer" onClick={this.handleClose.bind(this)} />
<div className="popup__content">{this.props.children}</div>
</div>
</Dialog>
);
}
}