Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidUpdate(prevProps: PropsType) {
if (!prevProps.isOpen && this.props.isOpen) {
const element = document.getElementById('qrCode');
this.qrCode = new qrcode(element);
this.qrCode.generate(this.props.text, this.props.qrCodeOptions).then(() => {
this.setState({
showModal: true,
});
});
} else if (prevProps.isOpen && !this.props.isOpen) {
this.qrCode = null;
this.setState({
showModal: false,
});
}
}