INNER CODE UNIT · JavaScript
MessengerPage
misa-j/social-network · client/src/App.js:23
const MessengerPage = lazy(() => import("./MessengerPage/MessengerPage"));
const Navbar = lazy(() => import("./components/Navbar"));
class App extends React.Component {
componentDidMount() {
const { dispatch } = this.props;
window.addEventListener("scroll", this.handleNotificationPopupClose);
history.listen((location, action) => {
// clear alert on location change
dispatch(alertActions.clear());
});
}
handleNotificationPopupClose = () => {
const { dispatch, isOpen } = this.props;
if (isOpen) {
dispatch(notificationActions.closeNotificationPopup());
}