Closed debotos closed 4 years ago
I found the solution. Added a click listener.
componentDidMount() {
window.addEventListener('click', this.handleMouseClick)
}
componentWillUnmount() {
window.removeEventListener('click', this.handleMouseClick)
}
handleMouseClick = () => {
this.props.hideNotification()
}
My code snippet,
My expectation is after seeing this notification if the user clicks anywhere on the page the notification should close. But currently, it's only closing when the user clicks on it neither it stays forever until a page refresh. And I don't want to close this message if the user is not interacting with the app. Any solution for this situation? Thanks.