I Want to show modal popup in spfx react webpart. Below is the code I am using:
<div>
<button onClick={e => this._OpenModal(this)}>Open Modal</button>
<div id="myModal" className="modal">
<div className="modal-content">
<span className="close" onClick={e => this._CloseModal(this)}>×</span>
<p>Some text in the Modal..</p>
</div>
</div>
</div>
private _OpenModal = (e): void => {
e.style.display = "block";
// tslint:disable-next-line:semicolon
};
private _CloseModal = (e): void => {
e.style.display = "none";
// tslint:disable-next-line:semicolon
};
But I am unable to fire style.display
.
Please guide ne how to fire the event?
Error :
TypeError: Cannot set property 'display' of undefined at ShopingCart._this._OpenModal